Hey Everyone,
This is my second post so bare with me. I am trying to get some format exceptions to the following text boxes. It's starting to get on my nerves. I just hope I'm somewhat close to the solution but here is the code. I feel like I could do this with if-else statements or a do while statement. When I try and run the program it shows the messages but continues on and does not the user re-enter the text.
private void submit_btn_Click(object sender, EventArgs e)
{
while (anError != true)
{
if (vin_txt.Text.Length < 17)
{
MessageBox.Show("A VIN has more Characters");
anError = true;
vin_txt.Clear();
break;
}
if (vin_txt.Text == "")
{
MessageBox.Show("You need to enter a VIN");
}
if (make_txt.Text == "")
{
MessageBox.Show("You need to enter a vehicle make");
}
if (model_txt.Text == "")
{
MessageBox.Show("You need to Enter a vehicle model");
}
if (year_txt.Text == "")
{
MessageBox.Show("You need to enter a vehicle year");
}
if (odometer_txt.Text == "")
{
MessageBox.Show("You need to enter an Odometer value");
}
if (Convert.ToInt32(odometer_txt.Text) > 300000)
{
MessageBox.Show("The odometer value is too large");
}
if (wIP_rad.Checked == false)
{
if (partCar_rad.Checked == false)
{
MessageBox.Show("You did not enter a Vehicle Status");
}
}
if (partCar_rad.Checked == false)
{
if (wIP_rad.Checked == false)
{
MessageBox.Show("You did not enter a Vehicle Status");
}
}
if (price_txt.Text == null)
{
MessageBox.Show("Please enter a price");
}
}
if (this.partCar_rad.Checked)
{
aStatus = partCar_rad.Text;
}
if (this.wIP_rad.Checked)
{
aStatus = wIP_rad.Text;
}