// Populate the ComboBox internal void GetGroupsInComboBoxes() { // Populate Edit ComboBox this.comboBoxEditGroupId.Text = string.Empty; this.comboBoxEditGroupId.DataSource = group.GetGroups(Globals.GlobalUserId); this.comboBoxEditGroupId.DisplayMember = "GroupName"; this.comboBoxEditGroupId.ValueMember = "GroupId"; // Populate Remove ComboBox this.comboBoxRemoveGroupId.Text = string.Empty; this.comboBoxRemoveGroupId.DataSource = group.GetGroups(Globals.GlobalUserId); this.comboBoxRemoveGroupId.DisplayMember = "GroupName"; this.comboBoxRemoveGroupId.ValueMember = "GroupId"; }
// Populate the ComboBox private void GetGroupsInComboBox() { GROUP group = new GROUP(); DataTable table = group.GetGroups(Globals.GlobalUserId); this.CheckBoxEnableGroups.Enabled = true; this.CheckBoxEnableGroups.Checked = true; this.comboBoxGroup.DataSource = table; this.comboBoxGroup.DisplayMember = "GroupName"; this.comboBoxGroup.ValueMember = "GroupId"; }
// Form Load private void Contact_Full_List_Form_Load(object sender, EventArgs e) { this.DataGridView_ContactsList.RowTemplate.Height = 80; // Populate the ListBox with Group Names GROUP group = new GROUP(); this.ListBoxGroups.DataSource = group.GetGroups(Globals.GlobalUserId); this.ListBoxGroups.DisplayMember = "GroupName"; this.ListBoxGroups.ValueMember = "GroupId"; // Populate DataGridView with Contacts PopulateContactsInDataGridView(); }
// CheckBox Checked Change Method private void CheckBoxEnableGroups_CheckedChanged(object sender, EventArgs e) { if (this.CheckBoxEnableGroups.Checked == true) { // Populate Edit ComboBox GROUP group = new GROUP(); this.comboBoxGroup.Enabled = true; this.comboBoxGroup.DataSource = group.GetGroups(Globals.GlobalUserId); this.comboBoxGroup.DisplayMember = "GroupName"; this.comboBoxGroup.ValueMember = "GroupId"; } else { this.comboBoxGroup.DataSource = null; this.comboBoxGroup.Enabled = false; } }