private void CodeTypetextBox_Validated(object sender, EventArgs e) { if (iACDataSet.PAYCODE.Rows.Count < 1 || CodeTypetextBox.Text.TrimEnd() == "") { return; } DataRow FoundRow; if ((CodeTypetextBox.Text == "H" || CodeTypetextBox.Text == "L") && PaymentTypetextBox.Text != "W") { PaymentTypetextBox.Text = "W"; } if (PaymentTypetextBox.Text == "W") { switch (CodeTypetextBox.Text.ToString().TrimEnd()) { case "L": case "H": break; case "C": default: CodeTypetextBox.Text = "H"; break; } } if (PaymentTypetextBox.Text == "W" && iACDataSet.PAYCODE.Rows.Count != 2) { pAYCODETableAdapter.FillByCodeW(iACDataSet.PAYCODE); } FoundRow = iACDataSet.PAYCODE.Rows.Find(CodeTypetextBox.Text.ToString().TrimEnd()); if (FoundRow == null) { if (CodeTypetextBox.Text.ToString().Trim().Length != 0) { MessageBox.Show("Sorry no payment code found that matches your selected payment code!"); CodeTypetextBox.Text = ""; ActiveControl = PAYCODEcomboBox; CodeTypetextBox.SelectAll(); } } else { PAYCODEcomboBox.Text = FoundRow.Field <String>("DESCRIPTION"); } }
private void PaymentTypetextBox_Validated(object sender, EventArgs e) { if (PaymentTypetextBox.Text.TrimEnd() == "") { return; } DataRow FoundRow; if (iACDataSet.PAYMENTTYPE.Rows.Count == 0) { pAYMENTTYPETableAdapter.Fill(iACDataSet.PAYMENTTYPE); } FoundRow = iACDataSet.PAYMENTTYPE.Rows.Find(PaymentTypetextBox.Text.ToString().TrimEnd()); if (FoundRow == null) { if (PaymentTypetextBox.Text.ToString().Trim().Length != 0) { MessageBox.Show("Incorrect Payment Type entered. Please respecify."); } if (Program.gbClosedPaymentAdd || Modal) { ActiveControl = PaymentTypecomboBox; PaymentTypecomboBox.SelectAll(); } } else { PaymentTypecomboBox.Text = FoundRow.Field <String>("DESCRIPTION"); if (PaymentTypetextBox.Text.ToString().ToUpper().TrimEnd() == "W") { pAYCODETableAdapter.FillByCodeW(iACDataSet.PAYCODE); } else { pAYCODETableAdapter.Fill(iACDataSet.PAYCODE); } if (Modal || Program.gbClosedPaymentAdd) { ActiveControl = CodeTypetextBox; CodeTypetextBox.SelectAll(); } } }
private void PaymentTypecomboBox_SelectedIndexChanged(object sender, EventArgs e) { if (PaymentTypecomboBox.SelectedIndex >= 0) { PaymentTypetextBox.Text = iACDataSet.PAYMENTTYPE.Rows[PaymentTypecomboBox.SelectedIndex].Field <String>("TYPE"); } if (PaymentTypetextBox.Text.ToString().ToUpper().TrimEnd() == "W") { pAYCODETableAdapter.FillByCodeW(iACDataSet.PAYCODE); } else { pAYCODETableAdapter.Fill(iACDataSet.PAYCODE); } if (ActiveControl == PaymentTypecomboBox) { ActiveControl = CodeTypetextBox; CodeTypetextBox.SelectAll(); } }