17-12-17, 04:39 PM
كود :
Public Class Form1
Private Sub TextBox1_KeyUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyUp
Dim p, c, m As Double
If TextBox1.Text = "" Then
p = 0
Else
p = Convert.ToDouble(TextBox1.Text)
End If
If TextBox2.Text = "" Then
c = 0
Else
c = Convert.ToDouble(TextBox2.Text)
End If
m = p * c
TextBox3.Text = m.ToString()
End Sub
Private Sub TextBox2_KeyUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox2.KeyUp
Dim p, c, m As Double
If TextBox1.Text = "" Then
p = 0
Else
p = Convert.ToDouble(TextBox1.Text)
End If
If TextBox2.Text = "" Then
c = 0
Else
c = Convert.ToDouble(TextBox2.Text)
End If
m = p * c
TextBox3.Text = m.ToString()
End Sub
End Class