Howdy, Stranger!

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

Categories

I need help on combo box and text box....

mOskimOski Member Posts: 44
I'm trying to use a combo box to multiply the value of a textbox when an image box is clicked, here's the code:


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

Private Sub image_multi1_Click()

If cmbo_amt(0).Text = 2 Then

If amt_mulit1 = 2 Then

txt_CHO(0).Text = txt_CHO(0).Text / 2

End If

txt_CHO(0).Text = txt_CHO(0).Text * 2

amt_mulit1 = 2

End If


If cmbo_amt(0).Text = 3 Then

txt_CHO(0).Text = txt_CHO(0).Text * 3

If amt_mulit1 = 3 Then

txt_CHO(0).Text = txt_CHO(0).Text / 3

End If

amt_mulit1 = 3


End If


If cmbo_amt(0).Text = 4 Then

txt_CHO(0).Text = txt_CHO(0).Text * 4

If amt_mulit1 = 4 Then

txt_CHO(0).Text = txt_CHO(0).Text / 4

End If

amt_mulit1 = 4


End If


If cmbo_amt(0).Text = 5 Then

txt_CHO(0).Text = txt_CHO(0).Text * 5

If amt_mulit1 = 5 Then

txt_CHO(0).Text = txt_CHO(0).Text / 5

End If

amt_mulit1 = 5


End If


If cmbo_amt(0).Text = 6 Then

txt_CHO(0).Text = txt_CHO(0).Text * 6

If amt_mulit1 = 6 Then

txt_CHO(0).Text = txt_CHO(0).Text / 6

End If

amt_mulit1 = 6


End If


If cmbo_amt(0).Text = 7 Then

txt_CHO(0).Text = txt_CHO(0).Text * 7

If amt_mulit1 = 7 Then

txt_CHO(0).Text = txt_CHO(0).Text / 7

End If

amt_mulit1 = 7


End If


If cmbo_amt(0).Text = 8 Then

txt_CHO(0).Text = txt_CHO(0).Text * 8

If amt_mulit1 = 8 Then

txt_CHO(0).Text = txt_CHO(0).Text / 8

End If

amt_mulit1 = 8


End If


If cmbo_amt(0).Text = 9 Then

txt_CHO(0).Text = txt_CHO(0).Text * 9

If amt_mulit1 = 9 Then

txt_CHO(0).Text = txt_CHO(0).Text / 9

End If

amt_mulit1 = 9

End If


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

Now my problem is that when the text of the combo box is changed, it gets multiplied, for example if the combo's text is 3 and the textbox is 6 and I clicked the image box the answer is 18. I was able to stop the value of the text box from being multiplied again and again when the image box is clicked but when I change the combo's text to 6 and the image box is clicked, it gets multiplied by 6....

newbie needs help here.... (T_T)

thank you in advance to the one that will answer this question.....
Sign In or Register to comment.