Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

C# Windows Form Validation

$
0
0

Hello all,

I have a dialog that asks the user for a name.  Because I don't want to initialize the dialog with a table of preexisting names, I want the code that validates the name isn't duplicated to sit outside the dialog.  My dialog's OK button click event starts with

            if (Validate())

and my exe has the

                MyDialog.Validating += new CancelEventHandler(MyDialog_Validating);

but my

        void MyDialog_Validating(object sender, CancelEventArgs e)
        {
            //If you see duplicates...
            e.Cancel = true;
        }

isn't getting called.  What am I doing wrong?

Thank you in advance.


Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>