private void comboBox4_SelectionChangeCommitted(object sender, EventArgs e) { label_AgentID_Representative.Text = comboBox_AgentID.SelectedValue.ToString(); if (Convert.ToInt32(label_AgentID_Representative.Text) > 0) { anAgent.ID = Convert.ToInt32(label_AgentID_Representative.Text); anAgent = agentH.Show(anAgent.ID); numericUpDown_Percentage.Value = anAgent.CommissionPercentage; numericUpDown_Amount.Value = Convert.ToDecimal(anAgent.CommissionAmount); comboBox_RatioType.SelectedIndex = (int)anAgent.CommissionRatioType; comboBox5_SelectionChangeCommitted(sender, e); } textBox_AgentID.Text = comboBox_AgentID.Text; label_AgentID.Text = comboBox_AgentID.SelectedValue.ToString(); }
private void button2_Click(object sender, EventArgs e) { try { var bindingList = AgentH.Show(anAgent); var source = new BindingSource(bindingList, null); dataGridView_.DataSource = source; } catch (DataExistence ex) { MessageBox.Show(ex.Message, "Data Entry Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { MessageBox.Show(ex.Message, "Data Entry Error - Unhandled", MessageBoxButtons.OK, MessageBoxIcon.Error); } }