private void coursetxt_SelectedIndexChanged(object sender, EventArgs e) { KeyValuePair <int, string> selectValue = (KeyValuePair <int, string>)coursetxt.SelectedItem; cID = selectValue.Key.ToString(); this.courseID.Text = cID; crs.GetDetail(cID); FillFormData(); }
private void CourseAddForm_Load(object sender, EventArgs e) { crs = new crs(); this.courseDuration.SelectedIndex = 0; this.courseType.SelectedIndex = 0; Dictionary <int, string> dict = crs.CourseList(); this.coursetxt.DataSource = new BindingSource(dict, null); coursetxt.DisplayMember = "Value"; coursetxt.ValueMember = "Key"; crs.GetDetail(cID); }