/// <summary> /// In forms constructor the not necessarily labels, tetxboxes and comboboxes are hiding /// from the form. Then the combobox for province(comboBoxptovince) is filling with the data from table province. /// </summary> public EditProvince() { InitializeComponent(); TbxProvinceName.Hide(); labelpro.Hide(); BtnEdit.Hide(); comboBoxptovince.DataSource = DCom.GetData("SELECT * FROM province"); comboBoxptovince.DisplayMember = "Province_Name"; comboBoxptovince.ValueMember = "Province_Name"; }
/// <summary> /// When the client select the privince that wants to edit the not necessarily labels, tetxboxes and comboboxes are hiding /// from the form and then the neccesarily labels, tetxboxes and comboboxes are pop up. Then fills all the fields with /// the data of the selected province. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnselect_Click(object sender, EventArgs e) { label2.Hide(); comboBoxptovince.Hide(); TbxProvinceName.Hide(); btnselect.Hide(); labelpro.Show(); TbxProvinceName.Show(); BtnEdit.Show(); SelectedData = DCom.GetData(String.Format(SqlExec, comboBoxptovince.SelectedValue)); TbxProvinceName.Text = (string)SelectedData.Rows[0]["Province_Name"]; }