Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TextBox5.Enabled = False
End Sub
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then
If Asc(e.KeyChar) = 46 Or Asc(e.KeyChar) = 8 Then
e.Handled = False
Else
e.Handled = True
End If
Private Sub TextBox2_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox2.KeyPress
If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then
If Asc(e.KeyChar) = 46 Or Asc(e.KeyChar) = 8 Then
e.Handled = False
Else
e.Handled = True
End If
Private Sub TextBox3_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox3.KeyPress
If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then
If Asc(e.KeyChar) = 46 Or Asc(e.KeyChar) = 8 Then
e.Handled = False
Else
e.Handled = True
End If
Private Sub TextBox4_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox4.KeyPress
If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then
If Asc(e.KeyChar) = 46 Or Asc(e.KeyChar) = 8 Then
e.Handled = False
Else
e.Handled = True
End If
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox3.Text = CSng(TextBox1.Text) / CSng(TextBox2.Text)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
TextBox5.Text = (CSng(TextBox3.Text) - 1) * CSng(TextBox4.Text)
End Sub
浙公网安备 33010602011771号