Change Table Border Width Using JavaScript

Nitya Raut
Updated on 23-Jun-2020 10:58:32

1K+ Views

To change the width of a table border, use the DOM border property. You can try to run the following code to change the width of a table border in JavaScript −Example                    function borderFunc(x) {             document.getElementById(x).style.border = "5px dashed blue";          }                                             One             Two                                 Three             Four                                 Five             Six                                          

Call a Method Asynchronously in C#

Samual Sam
Updated on 23-Jun-2020 10:50:01

304 Views

Asynchronous programming in C# is an efficient approach towards activities blocked or access is delayed. If an activity is blocked like this in a synchronous process, then the complete application waits and it takes more time. The application stops responding. Using asynchronous approach, the applications continues with other tasks as well.An application with a GUI, check the content of the queue and if an unprocessed task is there, it takes it out and processes it first. The code executes synchronously and the unprocessed task is completed first. The application will show stop responding messages if the processing takes more time ... Read More

IsFixedSize Property of SortedList Class in C#

George John
Updated on 23-Jun-2020 10:05:00

133 Views

Use the IsFixedSize property in C# to get a value indicating whether the SortedList has a fixed size.The following is an example showing SorteList with the usage of IsFixedSize property.Example Live Demousing System; using System.Collections; namespace Demo {    class Program {       static void Main(string[] args) {          SortedList s = new SortedList();          s.Add("S1", "Maths");          s.Add("S2", "Science");          s.Add("S3", "English");          s.Add("S4", "Economics");          Console.WriteLine("IsFixedSize = " + s.IsFixedSize);       }    } }OutputIsFixedSize = FalseWe ... Read More

IsReadOnly Property of SortedList Class in C#

Arjun Thakur
Updated on 23-Jun-2020 10:03:48

134 Views

Use the IsReadOnly property to get a value indicating whether the SortedList is read-only or not.You can try to run the following code to implement IsReadOnly property in C#.Here, we have set the SortedList first.SortedList s = new SortedList();Added elements.s.Add("S001", "Jack"); s.Add("S002", "Henry");Now check for IsReadOnly.Console.WriteLine("IsReadOnly = " + s.IsReadOnly);The following is the complete code.Example Live Demousing System; using System.Collections; namespace Demo {    class Program {       static void Main(string[] args) {          SortedList s = new SortedList();          s.Add("S001", "Jack");          s.Add("S002", "Henry");          Console.WriteLine("IsReadOnly ... Read More

Character Constants vs String Literals in C#

karthikeya Boyini
Updated on 23-Jun-2020 10:03:16

517 Views

Character constantsCharacter literals are enclosed in single quotes. For example, 'x' and can be stored in a simple variable of char type. A character literal can be a plain character (such as 'x'), an escape sequence (such as '\t'), or a universal character (such as '\u02C0').Certain characters in C# are preceded by a backslash. They have special meaning and they are used to represent like newline () or tab (\t).Example Live Demousing System; namespace Demo {    class MyApplication {       static void Main(string[] args) {          Console.WriteLine("Welcome\t to the website");          Console.ReadLine(); ... Read More

Check If a File Exists in C#

Samual Sam
Updated on 23-Jun-2020 10:02:16

10K+ Views

Use the File.exists method in C# to check if a file exits in C# or not.Firstly, check whether the file is present in the current directory.if (File.Exists("MyFile.txt")) {    Console.WriteLine("The file exists."); }After that check whether the file exist in a directory or not.if (File.Exists(@"D:\myfile.txt")) {    Console.WriteLine("The file exists."); }Let us see the complete example to check if a file exists in C#.Example Live Demousing System; using System.IO; class Demo {    static void Main() {       if (File.Exists("MyFile.txt")) {          Console.WriteLine("File exists...");       } else {          Console.WriteLine("File does ... Read More

IsFixedSize Property of Hashtable Class in C#

karthikeya Boyini
Updated on 23-Jun-2020 10:01:24

130 Views

Use the isFixedSize property of Hashtable class to get a value indicating whether the Hashtable has a fixed size.The following is an example showing how to work with IsFixedSize property.Example Live Demousing System; using System.Collections; namespace Demo {    class Program {       static void Main(string[] args) {          Hashtable ht = new Hashtable();          ht.Add("D01", "Finance");          ht.Add("D02", "HR");          ht.Add("D03", "Operations");          Console.WriteLine("IsFixedSize = " + ht.IsFixedSize);          Console.ReadKey();       }    } }OutputIsFixedSize = FalseAbove we ... Read More

Check If Both Halves of the String Have Same Set of Characters in C#

George John
Updated on 23-Jun-2020 10:00:49

236 Views

Firstly, set the string to be checked.string s = "timetime";Now set two counters for two halves of the string.int []one = new int[MAX_CHAR]; int []two = new int[MAX_CHAR];Check for both the halves of the string.for (int i = 0, j = l - 1; i < j; i++, j--) {    one[str[i] - 'a']++;    two[str[j] - 'a']++; }The following is the complete code to check whether both the halves of the string have same set of characters or not in C#.Example Live Demousing System; class Demo {    static int MAX_CHAR = 26;    static bool findSameCharacters(string str) {   ... Read More

Set Starting Position of Background Image in JavaScript DOM

Sharon Christine
Updated on 23-Jun-2020 10:00:38

553 Views

To set the starting position of a background image in JavaScript, use the backgroundposition property. It allows you to set the position of the image.ExampleYou can try to run the following code to learn how to set all the position of a background image with JavaScript −Live Demo                    body {             background-repeat: no-repeat;          }                     Click to Set background image                function display() {             document.body.style.backgroundImage = "url('https://www.tutorialspoint.com/html5/images/html5-mini-logo.jpg')";             document.body.style.backgroundPosition="top right";          }          

C# Program to Accept Two Integers and Return the Remainder

karthikeya Boyini
Updated on 23-Jun-2020 09:58:59

718 Views

Firstly, set the two numbers.int one = 250; int two = 200;Now pass those numbers to the following function.public int RemainderFunc(int val1, int val2) {    if (val2 == 0)    throw new Exception("Second number cannot be zero! Cannot divide by zero!");    if (val1 < val2)    throw new Exception("Number cannot be less than the divisor!");    else    return (val1 % val2); }Above we have checked for two conditions i.e.If the second number is zero, an exception occurs.If the first number is less than the second number, an exception occurs.To return remainder of two numbers, the following is ... Read More

Advertisements