Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27193

Two conditions inside an If Statement

$
0
0
I am trying to validate input in this VB program that calculates football stats. If both boxes are empty when a user clicks Update Stats, it should display a message box. However, with this code it shows the message whether both boxes are empty or if they have values entered. Any idea what I am doing wrong? I can post the entire code if need be. I can't think of anything. I've tried string.empty, string.IsNullOrWhiteSpace, .length < 0, so I am not sure what's going on.

Code:

' validate user input (ensure textBoxes aren't blank)
      If passYdTextBox.Text = "" And rushYdTextBox.Text = "" Then

        MessageBox.Show("Please enter values into pass yards box or rush yards box")

      End If


Viewing all articles
Browse latest Browse all 27193

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>