hello, learner here.
I have a function that checks a textbox for a value if it is below 500 or above 1000 it comes up with a message box. To invoke this I have the function at the top of a action for a button...
void Cal2Click(object sender, EventArgs e)
{
WPChk();
if (port.IsOpen) port.WriteLine("2");
else MessageBox.Show("Serial port is closed!", "RS232 tester", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
WPChk() is my function to check the value in the text box...
void WPChk()
{
try
{
int WhitePointValue;
WhitePointValue = int.Parse(WPTarget.Text);
if (WhitePointValue > 1000 || WhitePointValue < 500)
{
MessageBox.Show("The white point value is out of range. Try a value between 500 and 1000");
}
else WPTarget.Clear();
}
catch
{
MessageBox.Show("Invalid value for whitepoint target");
WPTarget.Clear();
}
}
I want the program to stop at that point until a button is pushed again but it just continues. What would you put under WPTarget.Clear(); to halt or am I going about this all the wrong way?
Thanks