Click to See Complete Forum and Search --> : A little problem....


AndyK
September 28th, 1999, 02:41 PM
this code is in the timer

max = max + 1
Text1.text = mid("blah", 1, max)
If max = 20 then Timer5.Enabled = false



Problem is that when timer being enabled, it just types in one first letter..."b" and stops, when it should keep on typing in whole word "blah"
I tried to remove If max = 20 Then Timer5.Enabled = False, still no effect....Please help

Thank You

Chris Eastwood
September 28th, 1999, 03:23 PM
Hi

You'll need to make the 'max' variable 'static' in that routine (so that it retains it's value between calls).

eg:


static max as Integer

max = max + 1
Text1.Text = mid("blah", 1, max)
If max = 20 then Timer5.Enabled = false




I'd also recommend that you change the last line to something like :



If max = 20 then
max = 0
Timer5.Enabled = false
End if




- so that the 'max' value get's reset again (otherwise it'll keep on going up & up).


Chris Eastwood

CodeGuru - the website for developers
http://codeguru.developer.com/vb