private void btnOk_Click(object sender, EventArgs e)
{
Boolean isGood = false;
if (txtConst.Text.Length > 0)
{
if (isNumeric)
{
switch (lblDataType.Text)
{
case "Integer":
int ires;
if (int.TryParse(txtConst.Text, out ires))
isGood = true;
break;
case "Double":
double dres;
if (double.TryParse(txtConst.Text, out dres))
isGood = true;
break;
}
}
else { isGood = true; }
}
if (isGood == false)
{
MessageBox.Show("The Value Entered DOES NOT Match the DataType", "Value Error");
return;
}
else { this.Close(); }
}