|
-
Jan 2nd, 2007, 01:40 PM
#1
Thread Starter
Addicted Member
Help with timer???
I want to make the Text1 box flipping donw gradually after pressing a the command button. What's wrong with the following code?
VB Code:
Private Sub Command1_Click()
Text1.Visible = True
Timer1.Enabled = True
Timer1.Interval = 1000
End Sub
Private Sub Timer1_Timer()
Dim i As Integer
For i = 1 To 2000
Text1.Height = i
If i = 2000 Then
Exit Sub
End If
Next i
End Sub
-
Jan 2nd, 2007, 01:54 PM
#2
Re: Help with timer???
What do you mean by "Flipping Down"?
In you example, the TextBox will grow.
-
Jan 2nd, 2007, 01:54 PM
#3
Re: Help with timer???
Keep in mind that sizes are set in Twips, and 15 twips makes one pixel.
The code you have would take 2000 seconds for the text box to have a height of 133 pixels, which is a looooong time.
And the Exit Sub is not needed. The loop will stop when i=2000 anyway, and since there's nothing after the loop, the sub will end.
-
Jan 2nd, 2007, 01:54 PM
#4
Re: Help with timer???
Not really sure what you mean...
Something like this?
VB Code:
Private Sub Command1_Click()
Timer1.Interval = 10
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Timer1.Enabled = False
If Text1.Height > 285 Then
Text1.Height = Text1.Height - 10
End If
Timer1.Enabled = Not Text1.Height <= 285
End Sub
-
Jan 2nd, 2007, 02:07 PM
#5
Thread Starter
Addicted Member
Re: Help with timer???
I want the Text Box to gradually expand down upto height of 2000.
-
Jan 2nd, 2007, 02:12 PM
#6
Re: Help with timer???
VB Code:
Private Sub Command1_Click()
Timer1.Enabled = True 'start the expanding
End Sub
Private Sub Form_Load()
Text1.Height = 1
Timer1.Interval = 67 'speed of change
Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
Text1.Height = Text1.Height + 15 'increases size of text box
If Text1.Height >= 2000 Then Timer1.Enabled = False 'turns timer off when target height is reached
End Sub
-
Jan 2nd, 2007, 02:14 PM
#7
Re: Help with timer???
Text1.Height = Text1.Height - i
-
Jan 2nd, 2007, 04:42 PM
#8
Thread Starter
Addicted Member
Re: Help with timer???
Many thanks for all of you for help .. special thanks for timeshifter
-
Jan 2nd, 2007, 04:55 PM
#9
Re: Help with timer???
Anytime. We're here to help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|