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?
Govinda Rajulu YemineniPosted Jul 17, 2015, 6:35 AM
Ranjit PowarPosted Jul 9, 2015, 3:26 AM
Vilas ShendePosted Jul 9, 2015, 3:15 AM
Manoj BhoirPosted Jul 9, 2015, 1:08 AM
RakeshPosted Jul 9, 2015, 12:34 AM
hadoop hadoopPosted Jul 9, 2015, 12:25 AM
Vilas ShendePosted Jul 8, 2015, 11:22 PM