Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim num1 As Integer
Dim num2 As Integer
Dim num3 As Integer
Dim total As Integer
num1 = Val(TextBox1.Text)
num2 = Val(TextBox2.Text)
num3 = Val(TextBox3.Text)
total = (num1 + num2 + num3)
TextBox4.Text = total
If textBox1.Text = "" Then
MessageBox.Show("You must enter all fields", "Name Entry Error", _
MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End If
If TextBox2.Text = "" Then
MessageBox.Show("You must enter all fields", "Name Entry Error", _
MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End If
If TextBox3.Text = "" Then
MessageBox.Show("You must enter all fields", "Name Entry Error", _
MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End If
End Sub
If I dont enter any text into any of the first three textboxes; then how do I have the messagebox only come up once? Instead it'll come up three times.
This post has been edited by mbrother64: 26 September 2009 - 06:44 AM

New Topic/Question
Reply




MultiQuote






|