I am using an inputbox to allow the user to input some value.
If the user doesnt enter anything and clicks OK Button, i want to display a message box asking for input and show the same input box again.
If the user doesnt enter anything and clicks cancel button, then no messagebox to be displayed. How do i get through this?
RPRamesh Praveen Syncfusion Team June 25, 2003 06:44 AM
Listen to the OK button's click event, and if a valid value is not in the textbox, fire a message box and then set the focus back to the textbox; otherwise close the dialog by setting it's DialogResult value approriately. Note that the DialogResult property for this button control should be set to None.
RPRamesh Praveen Syncfusion Team June 25, 2003 06:56 AM
RPRamesh Praveen Syncfusion Team June 25, 2003 07:12 AM
Here is another way of doing it:
private void TextBox_Validating(object sender, System.ComponentModel.CancelEventArgs e)
// Do this only when the cancel button is not clicked.
e.Cancel = true;