Saturday, May 8, 2010

Hyeeee Friends !
Sorry for not posting for a long time as m having ma exms!
Have you ever try to scroll the text of any control within vc# ?
If no , here we go with this simple & small demo to teach you how to scroll the text of different controls as well as of your main form's Title text !

I used juss three controls - TextBox, Lable and a Timer control to scroll the text.
Add these three controls to your form
Select timer1 and press F4 for properties
Set Interval property = 150
Enable = true
Now double click on timer1 to generate its Tick event handler method
Write these two lines within timer1_Tick method

this.Text = this.Text.Substring(1) + this.Text[0];
label1.Text = label1.Text.Substring(1) + label1.Text[0];
what m doing is - M juss subtracting 1st character from the text string and appending it to the end of the text string in timer1's Tick event
Thats why the text seems to be scrolling .............
Thats it !

Download vs2008 project coding & demo.exe


Post a Comment