private void district_no_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 13) { try { District d = new District(); Thana t = new Thana(); districtbox.Text = d.getDistrictName(Convert.ToInt32(district_no.Text)); thanabox.DataSource = t.getThanaList(d.getDistrictNo(districtbox.Text.ToString())); thana_no.Select(); } catch (Exception ex) {MessageBox.Show(ex.ToString()); } } }
private void districtbox_SelectedIndexChanged(object sender, EventArgs e) { thanabox.Text = null; Thana t = new Thana(); District d = new District(); try { district_no.Text = d.getDistrictNo(districtbox.Text.ToString()).ToString(); thanabox.DataSource = t.getThanaList(Convert.ToInt32(district_no.Text.ToString())); thanabox.SelectedIndex = -1; thanabox.Select(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }