public void ResetPermanantAddress() { txtPerFlatNo.Clear(); txtPerHouseNo.Clear(); txtPerRoadNo.Clear(); txtPerBlock.Clear(); txtPerArea.Clear(); txtPerLandMark.Clear(); txtPerBuilding.Clear(); txtPerRoadName.Clear(); PerApostCodeText.Clear(); PerAPostOfficeCombo.Items.Clear(); PerAPostOfficeCombo.SelectedIndex = -1; PerAThanaCombo.Items.Clear(); PerAThanaCombo.SelectedIndex = -1; PerADistrictCombo.Items.Clear(); PerADistrictCombo.SelectedIndex = -1; PerADivisionCombo.Items.Clear(); PerADivisionCombo.SelectedIndex = -1; SameAsPACheckBox.CheckedChanged -= SameAsPACheckBox_CheckedChanged; SameAsPACheckBox.Checked = false; SameAsPACheckBox.CheckedChanged += SameAsPACheckBox_CheckedChanged; }
private void PerADivisionCombo_SelectedIndexChanged(object sender, EventArgs e) { try { con = new SqlConnection(cs.DBConn); con.Open(); string ctk = "SELECT RTRIM(Divisions.Division_ID) from Divisions WHERE Divisions.Division=@find"; cmd = new SqlCommand(ctk); cmd.Connection = con; cmd.Parameters.Add(new SqlParameter("@find", System.Data.SqlDbType.NVarChar, 50, "Division")); cmd.Parameters["@find"].Value = PerADivisionCombo.Text; rdr = cmd.ExecuteReader(); if (rdr.Read()) { divisionIdPer = (rdr.GetString(0)); } if ((rdr != null)) { rdr.Close(); } if (con.State == ConnectionState.Open) { con.Close(); } PerADivisionCombo.Text = PerADivisionCombo.Text.Trim(); PerADistrictCombo.SelectedIndex = -1; PerADistrictCombo.Items.Clear(); PerAThanaCombo.SelectedIndex = -1; PerAThanaCombo.Items.Clear(); PerAPostOfficeCombo.SelectedIndex = -1; PerAPostOfficeCombo.Items.Clear(); PerApostCodeText.Clear(); PerADistrictCombo.Enabled = true; PerADistrictCombo.Focus(); con = new SqlConnection(cs.DBConn); con.Open(); string ct = "select RTRIM(Districts.District) from Districts Where Districts.Division_ID = '" + divisionIdPer + "' order by Districts.Division_ID desc"; cmd = new SqlCommand(ct); cmd.Connection = con; rdr = cmd.ExecuteReader(); while (rdr.Read()) { PerADistrictCombo.Items.Add(rdr[0]); } con.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void ResetPresentAddress() { txtPreFlatNo.Clear(); txtPreHouseNo.Clear(); txtPreRoadNo.Clear(); txtPreBlock.Clear(); txtPreArea.Clear(); txtPreBuildingName.Clear(); txtPreRoadName.Clear(); txtPreLandMark.Clear(); PerApostCodeText.Clear(); PerAPostOfficeCombo.SelectedIndex = -1; PerAThanaCombo.SelectedIndex = -1; PerADistrictCombo.SelectedIndex = -1; PerADivisionCombo.SelectedIndex = -1; }