I have this small block of code that I want to catch a null or empty string in a text box called SerialNumberTB and exit out of the method after setting focus to the box that needs updating. Any ideas how to break or return to the form after the SerialNumberTB.Focus(); line?
{
// ** Argument Properties and Uses **
// ** args.MethodName **
// ** Add Event Handler Code **
EpiDataView test = (EpiDataView)oTrans.EpiDataViews["Start"];
if(test.HasRow)
{
string testJobNum = test.dataView[test.Row]["JobNum"].ToString();
string ckSerial = test.dataView[test.Row]["ShortChar01"].ToString();
string pJob = "P-";
string hJob = "H-";
string value = "";
if (testJobNum.Contains(pJob) || testJobNum.Contains(hJob));
{
bool serialCk = String.IsNullOrEmpty(SerialNumberTB.Value.ToString());
if (serialCk)
{
MessageBox.Show("Please input a valid Serial Number for this Assembly.");
SerialNumberTB.Focus();
//need some code here to break out of thei
}
}
}```