pause display

pause display of letters being generated in a textbox

Page 1 of 1

1 Replies - 879 Views - Last Post: 07 May 2009 - 04:18 PM Rate Topic: -----

#1 mil1234  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 109
  • Joined: 01-February 09

pause display

Post icon  Posted 07 May 2009 - 02:41 PM

Hi to all,
below i attached the sub i did using application.DoEvents and Thread.sleep so that letters(characters i'm generating in a richtextbox go into the same richtextbox with slow motion.Now i want that i do a button named (PAUSE),
by which i can pause this process,Any help is kindly appreciated
	' Display chars one by one in the RichTextBox during a interval of time.
	' This interval produces the animation
	Private Sub display_slow_motion(ByRef str As String)
		RichTextBox1.Clear()
		quit = False
		For i As Integer = 0 To str.Length - 1
			RichTextBox1.Text += str(i)
			If quit Then
				Exit For
			Else
				Thread.Sleep(speed)
				Application.DoEvents()
			End If
		Next
   End Sub


Is This A Good Question/Topic? 0
  • +

Replies To: pause display

#2 mark.bottomley  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 176
  • View blog
  • Posts: 990
  • Joined: 22-April 09

Re: pause display

Posted 07 May 2009 - 04:18 PM

you are using the wrong type of activity to trigger the writes - read the Timer class in the VB.NET documentation. Setup the due and the interval callbacks to transfer the characters and enable/disable (pause) it from a button click
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1