How to raise a validation event from a key press
Posted
by flavour404
on Stack Overflow
See other posts from Stack Overflow
or by flavour404
Published on 2010-06-15T01:49:36Z
Indexed on
2010/06/15
1:52 UTC
Read the original article
Hit count: 268
Hi,
I want to raise the:
private void txtbox_startdate_Validating(object sender, System.ComponentModel.CancelEventArgs e)
{}
Function from a key leave event. The leave event looks like:
private void txtbox_startdate_Leave(object sender, EventArgs e)
{}
The trouble is of course if I try and call it in this manner:
txtbox_startdate_Validating(sender, e)
An error is raised because in this case 'e' is an EventArgs whereas the validation function wants a System.ComponentModel.CancelEventArgs and so, how do I convert EventArgs to a System.ComponentModel.CancelEventArgs or create one so that I can call my validation function?
Thanks, R.
© Stack Overflow or respective owner