Saturday, September 3, 2011

How to select an option in dropdown by its index using JavaScript?

The below code will help you to select an option in a dropdown by its index


You can find more examples of the same in the below website

http://www.mredkj.com/tutorials/tutorial003.html

How to show scroll bars for a label in C# .net?

This functionality can be achieved by using a text box or a rich text box instead of a label


If your are using a Text box then you can achieve the same by below code.


textBox1.AppendText( "Hello World \r\n");

In the above code \r\n is used to print the “Hello World “text in new line each time it is added to the textbox control.

If your are using a Rich Text box then you can archive the same by below code. 

richTextBox1.Text = richTextBox1.Text + "Hellow World \r\n";
richTextBox1.HideSelection = false;
richTextBox1.Focus();
richTextBox1.SelectionStart = richTextBox1.Text.Length;
richTextBox1.ScrollToCaret();

In the above code \r\n is used to print the “Hello World “text in new line each time it is added to the rich textbox control.