D
Daniel
Hi all,
I create custom controls with textboxes on it, that need validation.
So I created methods like these...
void txtName_Validating(object sender, CancelEventArgs e)
{
// Name is required
if (txtName.Text.Trim() == "")
{
// simulate ErrorProvider
txtName.BackColor = Color.Aqua; // what about an error
message?
MessageBox.Show("Name is required!");
e.Cancel = true;
return;
}
txtName.BackColor = Color.White;
}
.... and in the Designer set the "Validating" - event to this method!
Now when I use these new custom control I want to make sure, that for
example on buttonOk-click all my controls get validated. How can I do
this?
I found examples with a Validate()-method, but I don't have this method
on compact framework!
Any workaround?
Thanks in advance
Daniel
I create custom controls with textboxes on it, that need validation.
So I created methods like these...
void txtName_Validating(object sender, CancelEventArgs e)
{
// Name is required
if (txtName.Text.Trim() == "")
{
// simulate ErrorProvider
txtName.BackColor = Color.Aqua; // what about an error
message?
MessageBox.Show("Name is required!");
e.Cancel = true;
return;
}
txtName.BackColor = Color.White;
}
.... and in the Designer set the "Validating" - event to this method!
Now when I use these new custom control I want to make sure, that for
example on buttonOk-click all my controls get validated. How can I do
this?
I found examples with a Validate()-method, but I don't have this method
on compact framework!
Any workaround?
Thanks in advance
Daniel