hadoop hadoop

hadoop hadoop

  • NA
  • 159
  • 51k

show message box for those textboxes which are empty

Jul 8 2015 7:58 PM
I've some textboxes in my win form. On submit button I want to check if all the textboxes are filled or not. I want to show message for only those textboxes which are empty.
For eg.
First Name >> txtbox_FirstName
Last Name >> txtbox_LastName
Middle Name >> txtbox_MiddleName
Address >> txtbox_Address
Class >> txtbox_Class
private void btnSubmit_Click(object sender, EventArgs e)
{
if (txtbox_FirstName.Text == "" || txtbox_LastName.Text == "" || txtbox_MiddleName.Text == "" || txtbox_Address.Text == "" || txtbox_Class.Text == "")
{
MessageBox.Show( MessageBoxButtons.OK, MessageBoxIcon.Information);
// focus on the empty text boxes
}
In the message box I want to say to the user, please fill the text box which is empty.
Suppose, if the user has not fill txtbox_LastName, the message should be "please enter Last Name"
if the user has not fill txtbox_FirstName and txtbox_Class, the message should be "please enter First Name and Class".
And also focus on the first empty text box.
How can I do that?

Answers (7)