casparas
Dec 29th, 1999, 06:13 PM
people i have a realy serious problem
general declarations
Function Plus(Z As Double, X As Double, Y As Double, A As Double)
Plus = Z + X + Y + A
End Function
Private Sub txt1_Change()
If txt1.Text = "" Then
txt1.Text = 0
End If
If txt2.Text = "" Then
txt2.Text = 0
End If
If txt3.Text = "" Then
txt3.Text = 0
End If
If txt4.Text = "" Then
txt4.Text = 0
End If
txt1234.Text = Plus(txt1.Text, txt2.Text, txt3.Text, txt4.Text)
End Sub
Private Sub txt2_Change()
If txt1.Text = "" Then
txt1.Text = 0
End If
If txt2.Text = "" Then
txt2.Text = 0
End If
If txt3.Text = "" Then
txt3.Text = 0
End If
If txt4.Text = "" Then
txt4.Text = 0
End If
txt1234.Text = Plus(txt1.Text, txt2.Text, txt3.Text, txt4.Text)
End Sub
Private Sub txt3_Change()
If txt1.Text = "" Then
txt1.Text = 0
End If
If txt2.Text = "" Then
txt2.Text = 0
End If
If txt3.Text = "" Then
txt3.Text = 0
End If
If txt4.Text = "" Then
txt4.Text = 0
End If
txt1234.Text = Plus(txt1.Text, txt2.Text, txt3.Text, txt4.Text)
End Sub
Private Sub txt4_Change()
If txt1.Text = "" Then
txt1.Text = 0
End If
If txt2.Text = "" Then
txt2.Text = 0
End If
If txt3.Text = "" Then
txt3.Text = 0
End If
If txt4.Text = "" Then
txt4.Text = 0
End If
txt1234.Text = Plus(txt1.Text, txt2.Text, txt3.Text, txt4.Text)
End Sub
ok now here is my first program on VB
(Snif snif)
and my problem is:
when i enter text in the textbox(not numbers)
program gives me an error type mismatch or
something like that
is there any posible way to display your own error message
(for egzample:sorry but you entered some text
you shoud enter numbers)
is there any way of writing only numbers
(i mean you can not write text at all just numbers)
how to make my code shorter?
sorry for my english(it's not my native language)
general declarations
Function Plus(Z As Double, X As Double, Y As Double, A As Double)
Plus = Z + X + Y + A
End Function
Private Sub txt1_Change()
If txt1.Text = "" Then
txt1.Text = 0
End If
If txt2.Text = "" Then
txt2.Text = 0
End If
If txt3.Text = "" Then
txt3.Text = 0
End If
If txt4.Text = "" Then
txt4.Text = 0
End If
txt1234.Text = Plus(txt1.Text, txt2.Text, txt3.Text, txt4.Text)
End Sub
Private Sub txt2_Change()
If txt1.Text = "" Then
txt1.Text = 0
End If
If txt2.Text = "" Then
txt2.Text = 0
End If
If txt3.Text = "" Then
txt3.Text = 0
End If
If txt4.Text = "" Then
txt4.Text = 0
End If
txt1234.Text = Plus(txt1.Text, txt2.Text, txt3.Text, txt4.Text)
End Sub
Private Sub txt3_Change()
If txt1.Text = "" Then
txt1.Text = 0
End If
If txt2.Text = "" Then
txt2.Text = 0
End If
If txt3.Text = "" Then
txt3.Text = 0
End If
If txt4.Text = "" Then
txt4.Text = 0
End If
txt1234.Text = Plus(txt1.Text, txt2.Text, txt3.Text, txt4.Text)
End Sub
Private Sub txt4_Change()
If txt1.Text = "" Then
txt1.Text = 0
End If
If txt2.Text = "" Then
txt2.Text = 0
End If
If txt3.Text = "" Then
txt3.Text = 0
End If
If txt4.Text = "" Then
txt4.Text = 0
End If
txt1234.Text = Plus(txt1.Text, txt2.Text, txt3.Text, txt4.Text)
End Sub
ok now here is my first program on VB
(Snif snif)
and my problem is:
when i enter text in the textbox(not numbers)
program gives me an error type mismatch or
something like that
is there any posible way to display your own error message
(for egzample:sorry but you entered some text
you shoud enter numbers)
is there any way of writing only numbers
(i mean you can not write text at all just numbers)
how to make my code shorter?
sorry for my english(it's not my native language)