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?

Vilas ShendeRank #1,114 · 1.7K reputationPosted Jul 8, 2015, 7:22 PM EDT
hadoop hadoop142 reputationPosted Jul 8, 2015, 8:25 PM EDT
RakeshRank #397 · 6.3K reputationPosted Jul 8, 2015, 8:34 PM EDT
Manoj BhoirRank #599 · 4K reputationPosted Jul 8, 2015, 9:08 PM EDT
Vilas ShendeRank #1,114 · 1.7K reputationPosted Jul 8, 2015, 11:15 PM EDT
Ranjit PowarRank #553 · 4.4K reputationPosted Jul 8, 2015, 11:26 PM EDT
Govinda Rajulu YemineniRank #1,518 · 1K reputationPosted Jul 17, 2015, 2:35 AM EDT