C
CaptainCaveman
Hi,
My form has an OK button, which I want to verify the data that has been
input.
Under certain conditions I dont want the form to close, i.e. when a control
has no data entered in to it.
Is there a property that I need to set to prevent the form from closing as
my OK handler function closes regardless?
OK Handler code is as follows
private void OnClkOK(object sender, EventArgs e)
{
//populate the member variables
if (m_tbText.Text.Length > 0)
{
tbText = m_tbText.Text;
AlternativeText = m_tbAlternativeText.Text;
m_tbText.Text = string.Empty;
m_tbAlternativeText.Text = string.Empty;
this.Close();
}
else
{
MessageBox.Show("A valid ID is required");
}
}
TIA
CC
My form has an OK button, which I want to verify the data that has been
input.
Under certain conditions I dont want the form to close, i.e. when a control
has no data entered in to it.
Is there a property that I need to set to prevent the form from closing as
my OK handler function closes regardless?
OK Handler code is as follows
private void OnClkOK(object sender, EventArgs e)
{
//populate the member variables
if (m_tbText.Text.Length > 0)
{
tbText = m_tbText.Text;
AlternativeText = m_tbAlternativeText.Text;
m_tbText.Text = string.Empty;
m_tbAlternativeText.Text = string.Empty;
this.Close();
}
else
{
MessageBox.Show("A valid ID is required");
}
}
TIA
CC