/********************************************************************************************************************* * * Methods Region Start * *********************************************************************************************************************/ #region // Scan in Reference Number and Check to See if it is Valid private void ReferenceNumber_TextBox_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { try { string JobNumber = ""; ReferenceNumber = ReferenceNumber_TextBox.Text; JobNumber = ReferenceNumber.Substring(0, 11); if (JobNumber.Length == 11 && (JobNumber.StartsWith("j") || JobNumber.StartsWith("J"))) { PartsNeeded_TextBox.Visible = true; PartsNeeded_Label.Visible = true; PartsNeeded_TextBox.Focus(); ReferenceNumber_TextBox.ReadOnly = true; ReferenceEnter_Button.Visible = false; Enter_Button.Visible = true; Scan_ListBox.Items.Clear(); Scan_ListBox.Items.Add("Please Enter The Number of Parts Needed"); PartsNeeded_TextBox.Focus(); } else if (JobNumber.Length != 11 || (JobNumber.StartsWith("j") || JobNumber.StartsWith("J")) == false) { MessageBox.Show("Reference Number Invalid" + "\nPlease Scan Reference Number Again"); ReferenceNumber_TextBox.Clear(); } } catch (Exception) { MessageBox.Show("Reference Number Invalid" + "\nPlease Scan Reference Number Again"); ReferenceNumber_TextBox.Clear(); } } }
private void ReferenceEnter_Button_Click(object sender, EventArgs e) { try { string JobNumber = ""; ReferenceNumber = ReferenceNumber_TextBox.Text; JobNumber = ReferenceNumber.Substring(0, 11); if (JobNumber.Length == 11) { PartsNeeded_TextBox.Visible = true; PartsNeeded_Label.Visible = true; PartsNeeded_TextBox.Focus(); ReferenceNumber_TextBox.ReadOnly = true; ReferenceEnter_Button.Visible = false; Enter_Button.Visible = true; } else if (JobNumber.Length != 11) { MessageBox.Show("Please Scan Reference Number Again"); } } catch (Exception) { MessageBox.Show("Please Scan Reference Number Again"); } }
private void ReferenceNumber_TextBox_Enter(object sender, EventArgs e) { if (ReferenceNumber_TextBox.Enabled == true) { ReferenceNumber_TextBox.Focus(); } else if (ReferenceNumber_TextBox.Enabled == false) { PartsNeeded_TextBox.Focus(); } }