Click here to Skip to main content
15,893,487 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
See more:
Hi guys, how actually can i create the few argument in "if else statement" so that if textbox 1, textbox 2, textbox 3 is empty its will pop-up error message and if the textbox is fill , its will go to else statement.

What I have tried:

pictureBox2.Visible = false;

if (string.IsNullOrWhiteSpace(tb5.Text))
{
    pictureBox2.Visible = true;
    MessageBox.Show("Please Complete the custodian detail !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

}
else
{
    //NEXT TO SLIDE B
    panel2.Location = new Point(12, 22);
Posted
Updated 30-Jul-17 16:41pm
Comments
BillWoodruff 31-Jul-17 0:26am    
The best way to handle this ... if all the TextBoxes are in the same container Control ... is by using the TextBoxes 'Validating event, and an 'ErrorProvider component. However, I think you are doing some kind of slide-show thing here.

Say a little more about how the user interacts with your app, and the structure of your app.
fakeer muhammed 2-Aug-17 0:37am    
Use 'AND' operator in IF condition
Kailash Polai 29-Aug-17 6:49am    
use OR operator "||" for all text box
like
if( IsNullOrWhiteSpace(txt1.Text) || IsNullOrWhiteSpace(txt2.Text) || so on... )

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900