Arjun Thakur has Published 1109 Articles

How to inject JavaScript in WebBrowser control?

Arjun Thakur

Arjun Thakur

Updated on 23-Jun-2020 12:59:49

1K+ Views

To inject JavaScript in WebBrowser control, use the following steps − Firstly, create a Windows Forms application in Visual Studio. Now, drag a WebBrowser control to the form Set the Url property. Right-click the project, choose to Add reference... → COM → Type Libraries Select "Microsoft HTML Object Library"  Add the following code to inject JavaScript.private void ... Read More

How to sort one dimensional array in descending order using non static method?

Arjun Thakur

Arjun Thakur

Updated on 23-Jun-2020 12:44:58

160 Views

Set the unsorted list first.int[] list = {87, 45, 56, 22, 84, 65};Now use a nested for loop to sort the list that is passed to a function.for(int i=0; ilt; arr.Length; i++) {    for(int j=i+1; j

How to use the Copy(, ,) method of array class in C#

Arjun Thakur

Arjun Thakur

Updated on 23-Jun-2020 12:35:11

268 Views

As the name suggests the Array.Copy() method in C# is used to copy elements of one array to another array.The following is the syntax.Array.Copy(src, dest, length);Heresrc = array to be copieddest = destination arraylength = how many elements to copyThe following is an example showing the usage of Copy(, , ... Read More

What are Booleans types in C#?

Arjun Thakur

Arjun Thakur

Updated on 23-Jun-2020 12:28:29

110 Views

For the Boolean type, the bool keyword is used and is an alias of System.Boolean.It is used to declare variables to store the Boolean values, true and false.Let us see an example to learn how to use bool in C#.Exampleusing System; public class Demo {    static void Main() { ... Read More

What are all the possible C# array initialization syntaxes?

Arjun Thakur

Arjun Thakur

Updated on 23-Jun-2020 12:16:46

78 Views

Array can be initialized in more than one ways in C#. Let us see some example.Method OneUsing size of array.int [] marks = new int[5] { 99, 98, 92, 97, 95};Method TwoBy omitting the size.int [] marks = new int[] { 99, 98, 92, 97, 95};Method ThreeInitializing at the time ... Read More

Difference between window.location.href, window.location.replace and window.location.assign in JavaScript?

Arjun Thakur

Arjun Thakur

Updated on 23-Jun-2020 12:14:47

383 Views

The window object includes the location object in JavaScript. It includes the following properties −window.location.hrefIt returns the URL of the current page.Example           Click below to get the complete URL of the page.       URL               ... Read More

How to create an infinite loop in C#?

Arjun Thakur

Arjun Thakur

Updated on 23-Jun-2020 12:10:34

1K+ Views

An infinite loop is a loop that never terminates and repeats indefinitely.Let us see an example to create an infinite loop in C#.Exampleusing System; namespace Demo {    class Program {       static void Main(string[] args) {          for (int a = 0; a < ... Read More

How to create a JavaScript code for multiple keys pressed at once?

Arjun Thakur

Arjun Thakur

Updated on 23-Jun-2020 11:59:51

493 Views

Use the keydown event in JavaScript to get to know which keys are pressed at once. The following is the script −Examplevar log = $('#log')[0],    keyPressed = []; $(document.body).keydown(function (evt) {    var li = keyPressed [evt.keyCode];    if (!li) {       li = log.appendChild(document.createElement('li'));     ... Read More

How to initialize two-dimensional arrays in C#?

Arjun Thakur

Arjun Thakur

Updated on 23-Jun-2020 11:28:14

17K+ Views

A 2-dimensional array is a list of one-dimensional arrays.Two-dimensional arrays may be initialized by specifying bracketed values for each row.int [, ] a = new int [4, 4] {    {0, 1, 2, 3} ,    {4, 5, 6, 7} ,    {8, 9, 10, 11} ,    {12, 13, ... Read More

What is the Item property of Hashtable class in C#?

Arjun Thakur

Arjun Thakur

Updated on 23-Jun-2020 11:21:41

73 Views

Gets or sets the value associated with the specified key. You can also use the Item property to add new elements.If a key does not exist, then you can include it like −myCollection["myNonexistentKey"] = myValueThe following is the code showing how to work with Item property of Hashtable class in ... Read More

Advertisements