Adding Numbers to txtbox

csawyer
02-21-2004, 03:14 AM
Hey all,

I'm trying to add numbers to a textbox everytime a button is clicked. i have an example of the code that i am currently using, but i would have to use this type of if statements for every number that i need inserted.

I want to be able to add 0.1 to a textbox until it reads 0.5 and then when they click it the 6th time i want it to show the next whole number, eg 1.0

Can someone show me a shortcut on how to do this because i don't want to be using these if then statements for every number up to 100



Private Sub cmdDotBall_Click()
If frmBowlingSummary.lblBowler1.Caption = ">" Then
frmBowlingSummary.txtOvers1.Text = "0.1"
Else
If frmBowlingSummary.txtOvers1.Text = "0.1" Then
frmBowlingSummary.txtOvers1.Text = "0.2"
Else
If frmBowlingSummary.txtOvers1.Text = "0.2" Then
frmBowlingSummary.txtOvers1.Text = "0.3"
Else
If frmBowlingSummary.txtOvers1.Text = "0.3" Then
frmBowlingSummary.txtOvers1.Text = "0.4"
Else
If frmBowlingSummary.txtOvers1.Text = "0.4" Then
frmBowlingSummary.txtOvers1.Text = "0.5"
Else
If frmBowlingSummary.txtOvers1.Text = "0.5" Then
frmBowlingSummary.txtOvers1.Text = "1.0"
End If
End If
End If
End If
End If
End If
End Sub


Thanks.

Cam.

thingimijig
02-21-2004, 05:11 AM
something like this, you will have to do something about when it hits 100.

Text1.Text = Val(Text1.Text) + 0.1

If Right$(Text1.Text, 2) = ".6" Then
Text1.Text = Round(Val(Text1.Text))
End If


thingimijig.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum