slow motioned display of textbox' string

mil1234

New member
Joined
Apr 25, 2009
Messages
3
Programming Experience
Beginner
Hi guys.This is my first thread in here.Can u please tell me what i can use as i 'm generating around 400 characters at random in a textbox.Now i want that when these are being generated each character go 1 by 1 in slow motion in the textbox??and not generate random and they go as a chunk in the textbox.thanks
 
You can use a timer control with the interval set to 100:

VB.NET:
	Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
		Timer1.Enabled = True
	End Sub

	Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
		Static counter As Integer
		counter += 1
		If counter = 400 Then
			Timer1.Enabled = False
		End If
		Dim randvar As New Random()
		Dim randchar As String
		randchar = Chr(randvar.Next(65, 123))
		TextBox1.Text &= randchar
	End Sub
 
I will suggest following this advice also:
help said:
To improve performance, create one Random to generate many random numbers over time, instead of repeatedly creating a new Random to generate one random number.
They are not talking about the performance speed of the code here, but how well the random distribution produced will be.
 
slow motion dispaly

You can use a timer control with the interval set to 100:

VB.NET:
	Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
		Timer1.Enabled = True
	End Sub

	Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
		Static counter As Integer
		counter += 1
		If counter = 400 Then
			Timer1.Enabled = False
		End If
		Dim randvar As New Random()
		Dim randchar As String
		randchar = Chr(randvar.Next(65, 123))
		TextBox1.Text &= randchar
	End Sub

thanks a lt solitaire plus john i did what i needed with your help
 
Back
Top