Click here to Skip to main content
15,886,799 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have two forms. one is Main Entry Form and other is District. In District form I Add district and i want that the District i add in District Table Show in District Combo Box of Main Entry Form.

What I have tried:

private void Mian_Entry_Form_Load(object sender, EventArgs e)
{

// TODO: THIS CODE LOAD DISTRICT TO COMBOBOX IN MAINENTRY FORM

string q = string.Format("Select districtid, districtname from district");
DataTable dt = new DataTable();
SqlDataAdapter sd = new SqlDataAdapter(q, connection);
sd.Fill(dt);
foreach (DataRow dr in dt.Rows)
{
comboBoxEditdistrict.Items.Add(dr[1].ToString());
//comboBoxEditdistrict.
}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900