?
Solved

Validating event not being fired

Posted on 2003-12-04
3
Medium Priority
?
214 Views
Last Modified: 2010-04-16
I am using an error provider to validate a text box, my problem is the event is not being raised when I go to another field, why ?

Here is my code:

private void txtUserId_Validating(object sender, System.ComponentModel.CancelEventArgs e )
{
     string error = null;
     MessageBox.Show("What !");
     if ( this.txtUserId.Text.Length == 0 )
    {
        error = "The userid is a mandatory field, please enter a userid.";
       e.Cancel = true;
    }

   this.errorProvider1.SetError((Control) sender,error);
}
0
Comment
Question by:rogaut1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 2

Author Comment

by:rogaut1
ID: 9875373
and yes the CausesValidation property for txtUserid is set to true.
0
 
LVL 2

Accepted Solution

by:
MattWare earned 2000 total points
ID: 9876848
What does the event handler code ok?

eg
this.object.event += new System.EventHandler(this.MethodName);
                  
0
 
LVL 2

Author Comment

by:rogaut1
ID: 9876949
That was the problem !   Thank you....the book I was reading never specified subcribing to the event.....




Thanks !


Robert
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question