//clears the content (useful for updating datagrid after add/delete) private void ClearContent() { agentIDTextBox.Clear(); agtFirstNameTextBox.Clear(); agtLastNameTextBox.Clear(); agtMiddleInitialTextBox.Clear(); agtBusPhoneTextBox.Clear(); agtEmailTextBox.Clear(); agtPositionComboBox.SelectedIndex = 2; //hovers over the junior agent option //resets the datagrid agents = AgentDB.GetAgents(); agentDataGridView.DataSource = agents; }
//builds the datagrid on load private void frmAgents_Load(object sender, EventArgs e) { this.WindowState = FormWindowState.Maximized; agents = AgentDB.GetAgents(); agentDataGridView.DataSource = agents; //clears out the duplicate types before they are added to the combo box List <string> agtPositions = new List <string>(); foreach (Agent agentPos in agents) { if (!agtPositions.Contains(agentPos.AgtPosition)) { agtPositions.Add(agentPos.AgtPosition); } } agtPositionComboBox.DataSource = agtPositions; agtPositionComboBox.SelectedIndex = 2; //hovers over the junior agent option agencies = AgencyDB.GetAgencies(); agencyIDComboBox.DataSource = agencies; }