Hi ,
In my project , I have one MDI Parent form and n number of child forms..I can open multiple child forms on my screen.
I have Form1 and it has two text boxes which is mandatory to enter. When the text box value is not entered , the cursor should not allow to focus on next control..So I have written validating event (as mentioned below) :
- private void txtCod_Validating(object sender, CancelEventArgs e)
- {
- try
- {
- if (clsMdiForm.blnBlankCheck(txtCode.Text, false, "CODE"))
- {
- e.Cancel = true;
- }
- else
- {
- e.Cancel = blnChkUniqueLoc(0);
- }
- }
- catch (Exception ex)
- {
- clsMdiForm.writeErrorLog(ex.HResult.ToString(), ex.Message, "txtCod_Validating", "frmMaLocation");
- }
- }
As per my requirement it should allow to close the form and allow to open some other forms also..
I am not getting the solution so I keep the bugs in deferred status..Please some one help me to sort out this issue.

Rupesh KahanePosted Jul 19, 2018, 1:10 PM
Try below solutions
1) If you possible to use javascript, then in javascript you can use on change event on that two textboxes and in javascript function check is empty or null and show alert message using javascript.
2) If you are not using any javascript then you can write same logic on button click event and in that get the values from both the textboxes and check is empty or null then return from that function else go to next process whatever logic.