Posted: Wed Dec 13, 2006 2:01 pm Post subject: My division Program needs some help!
Allright so im having a few problems.
1. I dont want the user to be able to se the number 0 for the first number but i want them to be able to do numbers like 60 or 80 and so on.
2. If they were to divide -5 by 50 they get the anwser but if they press the next button it keeps adding 0s to the end.
Any help would be appreciated , Thanks!
PewPewPewPewPewPew
code:
Dim Diviser As Double
Dim Divident As Double
Dim Ans As Double
Dim Num As Integer
Dim Counter As Integer
Dim Level As Integer
Dim Level2 As Integer
Dim Level3 As Integer
Private Sub Command1_Click()
Form1.Cls
Counter = Counter + 1
If Counter = 1 Then
Divisor = Val(Text1.Text)
Divident = Val(Text2.Text)
Ans = Int(Divident / Divisor)
Label1.Caption = Ans
Label5.Caption = Divisor * Label1.Caption
Level = Divident - Label5.Caption
Label3.Caption = Level
End If
If Counter = 2 Then
Level = (Level * 10)
Label3.Caption = Level
Level2 = Int(Level / Text1.Text)
Label1.Caption = Ans + (Level2 * 0.1)
Label4.Caption = Text1.Text * Level2
Label6.Caption = Level - Level2
End If
If Counter = 3 Then
Level3 = Int(Label6.Caption / Text1.Text)
Label1.Caption = Ans + (Level2 * 0.1) & Level3
Label7.Caption = Text1.Text * Level3
Label8.Caption = Label6.Caption - Label7.Caption
End If
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Command3_Click()
Counter = o
Text1.Text = ""
Text2.Text = ""
Label1.Caption = ""
Label3.Caption = ""
Label4.Caption = ""
Label5.Caption = ""
Label6.Caption = ""
Label7.Caption = ""
Label8.Caption = ""
End Sub
Private Sub Form_Load()
Form1.Cls
End Sub
Private Sub Text1_Change()
Counter = 0
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode > 56 And KeyCode < 97 Then
MsgBox ("Enter numbers only please.")
Text1.Text = ""
End If
If KeyCode > 119 Then
MsgBox ("Enter numbers only please.")
Text1.Text = ""
End If
End Sub
Private Sub Text2_Change()
Counter = 0
End Sub
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode > 56 And KeyCode < 97 Then
MsgBox ("Enter numbers only please.")
Text1.Text = ""
End If
If KeyCode > 119 Then
MsgBox ("Enter numbers only please.")
KeyCode = ""
Text1.Text = ""
End If
End Sub
The Extension 'exe' was deactivated by an board admin, therefore this Attachment is not displayed.
Sponsor Sponsor
cool dude
Posted: Wed Dec 13, 2006 3:16 pm Post subject: (No subject)
a few things.
1) indent
2) comments are helpful when you want sombody to debug your program for you and same with indentation!!!
3) for your question 2 just diable the button next so they can't keep on pressing it. (I don't really understand your first question be more specific).
P.S. why would you post your program as an executible when you want people to debug it for you? i was reluctant on even running it.