I'm trying to prevent a user from entering no value in a text box so as to prevent an error during code execution.
The text box values are assigned a default value like this:
wrkTbx.Text = "00 : 00 : 00 : 000";
restTbx.Text = "00 : 00 : 00 : 000";
This is how I'm trying to handle the user inputting no value in the textbox but the code still runs and doesn't show the message box to signal no input.
Does anyone know how handle the null input? as the below code doesn't work.
//Assign text box time string to string variables.
//check if string is empty.
if (String.IsNullOrEmpty(wrkTbx.Text) && String.IsNullOrEmpty(restTbx.Text))
{
MessageBox.Show("Please enter a work/rest interval");
}
else
{
rstString = restTbx.Text;
wrkString = wrkTbx.Text;
}