I've created a program with 2 textboxes and a button. The user must enter a value in each textbox. When the button is clicked, a message box pops up showing the sum of the values entered in each textbox.
Here's the code:
Here's what i want to add: if both or only one of the textboxes have no value entered in them, i want a message box to pop up and say "Please enter a value." I've tried using the do while statement and also used if statements but i kept getting errors. Can anybody help me out here?Code:Dim start As Integer Dim endnumber As Integer start = TextBox1.Text endnumber = TextBox2.Text If start > 0 And endnumber > 0 Then Dim answer As Integer answer = start + endnumber 'Answer becomes the integer in textbox1 + the integer in textbox2 MsgBox(answer) 'Message box pops up and displays the answer(the sum of textbox1 and textbox2) End If
Thanks




Reply With Quote