Help on timers...

I'm making a simple meal plan program. I'm almost finished but I'm having problems on how to make the timer to multiply the values of the textboxes automatically to the combo box's text like for example if the combo box's text is 2 then the textboxes will be multiplied to 2.I've tried to use other controls to make the timer stop once it multiplied the textboxes but it doesn't work out...

***********************************************
***this is the code of the program I'm making***

Private Sub Form_Load()

List1.AddItem "pic 1"
List1.AddItem "pic 1-2"

List2.AddItem "pic 2"
List2.AddItem "pic 2"


End Sub

Private Sub Label1_Click()

If Picture1.Top < 0 Then
Timer1.Enabled = True
Timer5.Enabled = True
End If


If Picture1.Top = 240 Then
Timer1.Enabled = False
End If

End Sub

Private Sub Label2_Click()

If Picture2.Top < 0 Then
Timer2.Enabled = True
End If


If Picture2.Top = 240 Then
Timer2.Enabled = False
End If

End Sub

Private Sub List1_DblClick()


Select Case List1.ListIndex

Case 0

If txt_try1.Text = "" Then

cmbo_amount.Locked = False

txt_try1.Text = List1.Text
addval = addval + 1


txt_CHON.Text = Val(txt_CHON.Text)
txt_CHO.Text = Val(txt_CHO.Text)
txt_FAT.Text = Val(txt_FAT.Text)

txt_CHO.Text = "2"
txt_CHON.Text = "3"
txt_FAT.Text = "5"

ElseIf txt_try1.Text <> "" Then

cmbo_amount.Locked = False

txt_try1_2.Text = List1.Text
addval = addval + 1

txt_CHO.Text = "3"
txt_CHON.Text = "5"
txt_FAT.Text = "6"

End If


Case 1

cmbo_amount.Locked = False

If txt_try1.Text = "" Then

txt_try1.Text = List1.Text
addval = addval + 1

txt_CHO.Text = "2"
txt_CHON.Text = "3"
txt_FAT.Text = "5"

ElseIf txt_try1.Text <> "" Then

cmbo_amount.Locked = False

txt_try1_2.Text = List1.Text
addval = addval + 1

End If

End Select



Text1.Text = "" & addval

End Sub
Private Sub List2_DblClick()

Select Case List2.ListIndex

Case 0
List3.AddItem "hoho!"
addval = addval + 1
Case 1
List3.AddItem "hihi!"
addval = addval + 1
End Select

Text1.Text = "" & addval

End Sub

Private Sub Timer_Timer()

If Check1.Value = 1 Then
Check1.Value = 0
Timer6.Enabled = True

End If

End Sub

Private Sub Timer1_Timer()


If Picture1.Left > 0 Then
Picture1.Move Picture1.Left - 0, Picture1.Top + 120

If Picture1.Top = 240 Then
Timer1.Enabled = False
End If

If Picture2.Top = 240 Then
Timer4.Enabled = True

If Picture2.Top = -2880 Then
Timer4.Enabled = False
End If

End If

End If

End Sub

Private Sub Timer2_Timer()

If Picture2.Left > 0 Then
Picture2.Move Picture2.Left - 0, Picture2.Top + 120

If Picture2.Top = 240 Then
Timer2.Enabled = False
End If

If Picture1.Top = 240 Then
Timer3.Enabled = True

If Picture1.Top = -2880 Then
Timer3.Enabled = False
End If

End If

End If

End Sub

Private Sub Timer3_Timer()

If Picture1.Left > 0 Then
Picture1.Move Picture1.Left - 0, Picture1.Top - 120

If Picture1.Top = -2880 Then
Timer3.Enabled = False
End If

End If

End Sub

Private Sub Timer4_Timer()

If Picture2.Left > 0 Then
Picture2.Move Picture2.Left - 0, Picture2.Top - 120

If Picture2.Top = -2880 Then
Timer4.Enabled = False
End If

End If

End Sub

Private Sub Timer5_Timer()

If Picture3.Left > 0 Then
Picture3.Move Picture3.Left - 0, Picture3.Top - 120

If Picture3.Top = -3240 Then
Timer5.Enabled = False
End If

End If

End Sub

Private Sub Timer6_Timer()

Timer7.Enabled = True

End Sub

Private Sub Timer7_Timer()

If cmbo_amount.Text = "2" Then
txt_CHO.Text = txt_CHO.Text * 2
txt_CHON.Text = txt_CHON.Text * 2
txt_FAT.Text = txt_FAT.Text * 2

End If


End Sub

**************************

If try out this codes, the textboxes will keep on multiplyng itself.
Thanks in advance to those that will help me..

ehehe...

Comments

  • : I'm making a simple meal plan program. I'm almost finished but I'm
    : having problems on how to make the timer to multiply the values of
    : the textboxes automatically to the combo box's text like for
    : example if the combo box's text is 2 then the textboxes will be
    : multiplied to 2.I've tried to use other controls to make the timer
    : stop once it multiplied the textboxes but it doesn't work out...



    timer seems like the hard way to try to do this. keep it simple, add a Button control and name it "Figure Meal" or something meaningful- place code in the Click event so when the user clicks it, your calculation will run.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion