Click here to Skip to main content
15,906,567 members
Home / Discussions / C#
   

C#

 
Generaldelete string-value Pin
mathon19-Oct-04 3:32
mathon19-Oct-04 3:32 
GeneralDataGrid "Special Key" Confusion Pin
RockmanHero200319-Oct-04 2:00
RockmanHero200319-Oct-04 2:00 
GeneralOverride Pin
Anonymous19-Oct-04 1:42
Anonymous19-Oct-04 1:42 
GeneralRe: Override Pin
Colin Angus Mackay19-Oct-04 2:11
Colin Angus Mackay19-Oct-04 2:11 
GeneralRe: Override Pin
Anonymous19-Oct-04 2:28
Anonymous19-Oct-04 2:28 
GeneralRe: Override Pin
Colin Angus Mackay19-Oct-04 2:35
Colin Angus Mackay19-Oct-04 2:35 
GeneralRe: Override Pin
Anonymous19-Oct-04 3:08
Anonymous19-Oct-04 3:08 
GeneralRe: Override Pin
Colin Angus Mackay19-Oct-04 3:22
Colin Angus Mackay19-Oct-04 3:22 
In your ValidTextBox class create an event, e.g.
public event EventHandler ValidateTextBox;


Then when you need to trigger the event you can write
this.ValidateTextBox(this, new EventArgs());


On your form you can then add a handler for the event, just like a handler for any other event with something like
myValidTextBox.ValidateTextBox+=new EventHandler(ObjectName_EventName);
Normally, after the += I just usually let intellisense take over and I just hit tab twice, the first time to complete this statement, the second time to create a method stub for the event handler.

Now, I would guess that you don't want the default EventHandler because it doesn't allow you to pass much information - just the sender (the object that triggered the event), so you might want to set up a delegate. This sits outside the class
public delegate void ValidateDelegate(object sender, ValidateTextBoxArgs e);
The ValidateDelegate here would replace EventHandler in the example above

You will also need to create a class that is derived from System.EventArgs, which above I've called ValidateTextBoxArgs

There are many source of information on this. If you need a step-by-step tutorial searching on the keywords delegate and event in msdn will likely turn up something useful - and I'm sure it will explain it better than I have done here.


Do you want to know more?


Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
GeneralRe: Override Pin
Anonymous19-Oct-04 4:28
Anonymous19-Oct-04 4:28 
Questionhow not to use proxy cashe. Pin
yu-yu19-Oct-04 0:39
yu-yu19-Oct-04 0:39 
GeneralAdding a checkbox column Pin
scotlandc18-Oct-04 23:43
scotlandc18-Oct-04 23:43 
GeneralRe: Adding a checkbox column Pin
Heath Stewart19-Oct-04 7:37
protectorHeath Stewart19-Oct-04 7:37 
GeneralRe: Adding a checkbox column Pin
scotlandc21-Oct-04 0:13
scotlandc21-Oct-04 0:13 
GeneralKeyUp Event Pin
exhaulted18-Oct-04 23:03
exhaulted18-Oct-04 23:03 
GeneralRe: KeyUp Event Pin
Stefan Troschuetz18-Oct-04 23:50
Stefan Troschuetz18-Oct-04 23:50 
GeneralRe: KeyUp Event Pin
exhaulted19-Oct-04 4:46
exhaulted19-Oct-04 4:46 
GeneralRe: KeyUp Event Pin
Stefan Troschuetz19-Oct-04 4:59
Stefan Troschuetz19-Oct-04 4:59 
GeneralRe: KeyUp Event Pin
exhaulted19-Oct-04 5:37
exhaulted19-Oct-04 5:37 
GeneralRe: KeyUp Event Pin
Stefan Troschuetz19-Oct-04 9:19
Stefan Troschuetz19-Oct-04 9:19 
GeneralPlease explain code! Pin
Brakanjan18-Oct-04 23:00
Brakanjan18-Oct-04 23:00 
GeneralRe: Please explain code! Pin
J4amieC18-Oct-04 23:43
J4amieC18-Oct-04 23:43 
QuestionHow can i create a handle for mouse events... Pin
Kiran Satish18-Oct-04 20:52
Kiran Satish18-Oct-04 20:52 
AnswerRe: How can i create a handle for mouse events... Pin
exhaulted19-Oct-04 4:50
exhaulted19-Oct-04 4:50 
GeneralRe: How can i create a handle for mouse events... Pin
Kiran Satish19-Oct-04 6:49
Kiran Satish19-Oct-04 6:49 
GeneralRe: How can i create a handle for mouse events... Pin
Kiran Satish19-Oct-04 13:45
Kiran Satish19-Oct-04 13:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.