6 Replies - 2329 Views - Last Post: 26 April 2009 - 04:07 AM Rate Topic: -----

#1 mil1234  Icon User is offline

  • D.I.C Head

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

Displaying in slow motion

Post icon  Posted 23 April 2009 - 01:39 PM

Hi to all,

i have a richtextbox full of letters.A message is written by the user in another textbox.This message is embedded into the generted letters in richtextbox by certain keys.Any ideas on how i can make this process which i 've already done be dispalyed in SLOW MOTION.............tnx
Is This A Good Question/Topic? 0
  • +

Replies To: Displaying in slow motion

#2 jurdendurden  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 39
  • Joined: 01-November 07

Re: Displaying in slow motion

Posted 23 April 2009 - 02:44 PM

View Postmil1234, on 23 Apr, 2009 - 12:39 PM, said:

Hi to all,

i have a richtextbox full of letters.A message is written by the user in another textbox.This message is embedded into the generted letters in richtextbox by certain keys.Any ideas on how i can make this process which i 've already done be dispalyed in SLOW MOTION.............tnx



Yes. Simply create a function which will pause for a brief period of time, create a for->next loop for transferring the text letter by letter, with a call to the pause function in between. Eg:


	Public Function wait(Optional ByVal mSeconds As Decimal = 0.01)

		Dim endTime As Date = Date.Now.AddSeconds(mSeconds)
		Do : Loop Until Date.Now > endTime

		Return 0
	End Function

	Private Sub XferText()
		For i = 0 to Len(text1.text)
			   'Add code to move the letter based on the position of 'i'
			   wait() '<-slight pause in between
		Next i
	End Sub



Was This Post Helpful? 0
  • +
  • -

#3 mil1234  Icon User is offline

  • D.I.C Head

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

Re: Displaying in slow motion

Posted 25 April 2009 - 04:06 AM

[quote name='jurdendurden' date='23 Apr, 2009 - 01:44 PM' post='617064']

View Postmil1234, on 23 Apr, 2009 - 12:39 PM, said:

Hi to all,

i have a richtextbox full of letters.A message is written by the user in another textbox.This message is embedded into the generted letters in richtextbox by certain keys.Any ideas on how i can make this process which i 've already done be dispalyed in SLOW MOTION.............tnx



Yes. Simply create a function which will pause for a brief period of time, create a for->next loop for transferring the text letter by letter, with a call to the pause function in between. Eg:


	Public Function wait(Optional ByVal mSeconds As Decimal = 0.01)

		Dim endTime As Date = Date.Now.AddSeconds(mSeconds)
		Do : Loop Until Date.Now > endTime

		Return 0
	End Function

	Private Sub XferText()
		For i = 0 to Len(text1.text)
			   'Add code to move the letter based on the position of 'i'
			   wait() '<-slight pause in between
		Next i
	End Sub




Hi friend thanks for that but i can't really understand how can this work for me.I have this line of code which i need to be executed:

	RichTextBox1.Text = Encryption.encrypt(r, pre, post, TextBox1.Text)


This line of code is getting all the functions made by me so that the message in textbox 1 is inserted according to the functions in the encryption class in the richtextbox1.What i need is to make this process in slow motion.Can u help me please or we try to implement that line of code in your code given to me??or maybe with another method.tnx
Was This Post Helpful? 0
  • +
  • -

#4 noorahmad  Icon User is offline

  • Untitled
  • member icon

Reputation: 209
  • View blog
  • Posts: 2,290
  • Joined: 12-March 09

Re: Displaying in slow motion

Posted 25 April 2009 - 04:35 AM

simply use the following code
Application.DoEvents()


Was This Post Helpful? 1
  • +
  • -

#5 mil1234  Icon User is offline

  • D.I.C Head

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

Re: Displaying in slow motion

Posted 25 April 2009 - 09:11 AM

View Postnoorahmad, on 25 Apr, 2009 - 03:35 AM, said:

simply use the following code
Application.DoEvents()



Hi tnx for the help.But lets suppose i'm generating 200 charaters by clicking a button in a textbox.How can i see by slow motion the characters being generated one by one going in the textbox?? (u know that if we generate 200 characters they are put as a chunk altoghether in the textbox.Now what i want is to achieve them one by one--seeing them being written??!!!
Was This Post Helpful? 0
  • +
  • -

#6 noorahmad  Icon User is offline

  • Untitled
  • member icon

Reputation: 209
  • View blog
  • Posts: 2,290
  • Joined: 12-March 09

Re: Displaying in slow motion

Posted 25 April 2009 - 09:24 PM

i cant get you question clearly but i think you should use
System.Threading.Thread.Sleep(1000) 'in milliseconds


if you post you code here then i will help you better.
and thanks :^:
Was This Post Helpful? 0
  • +
  • -

#7 Aurel300  Icon User is offline

  • D.I.C Head

Reputation: 13
  • View blog
  • Posts: 230
  • Joined: 10-November 07

Re: Displaying in slow motion

Posted 26 April 2009 - 04:07 AM

Ok, letīs assume:
- You have a text box (source) called sourceText
- You have another text box (slowmo target, you have RTF, but it is easy to change) called targetText
- You have a timer called slowmoTimer, disabled, interval - any that you want
- You have a button which is going to start the process (as it canīt delete letters, it will have to start alway from empty textbox) called startButton

So, the startButton will enable the slowmoTimer and set targetText.Text = "", no big deal.

And now, the slowmoTimerīs tick function:
Private Sub blah blah handles blah blah
If (sourceText.Text = targetText.Text) Then
MsgBox "Finished"
slowmoTimer.Enabled = false ' Finished!
Else
Dim addTo As Integer = targetText.Text.Lenght()
targetText.Text = targetText.Text & sourceText.Text.Chars(addTo)
End If
End Sub



Sorry if I did any mistake or something...
I actually didnīt test or write this in VB, so...
You will maybe need to use targetText.Text.Lenght() - 1

This post has been edited by Aurel300: 26 April 2009 - 04:08 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1