First combo box show Arabic membership
Second combo box show English member ship
I need to merge two combo box in one combo box show both of them
my code as below
MemberAR sheet and MemberEN sheet have two fields
MemberID , MemberName
- public DataTable ShowExcelDataArabic()
- {
-
- OleDbConnection con = new OleDbConnection(connection);
-
-
- con.Open();
- string str = "select * from [MemberAR$]";
- OleDbCommand com = new OleDbCommand();
- com = new OleDbCommand(str, con);
- OleDbDataAdapter oledbda = new OleDbDataAdapter();
- oledbda = new OleDbDataAdapter(com);
- DataSet ds = new DataSet();
- ds = new DataSet();
- oledbda.Fill(ds, "[MemberAR$]");
- con.Close();
- DataTable dt = new DataTable();
- dt = ds.Tables["[MemberAR$]"];
- return dt;
-
-
- }
- public DataTable ShowExcelDataEnglish()
- {
-
- OleDbConnection con = new OleDbConnection(connection);
-
-
- con.Open();
- string str = "select * from [MemberEN$]";
- OleDbCommand com = new OleDbCommand();
- com = new OleDbCommand(str, con);
- OleDbDataAdapter oledbda = new OleDbDataAdapter();
- oledbda = new OleDbDataAdapter(com);
- DataSet ds = new DataSet();
- ds = new DataSet();
- oledbda.Fill(ds, "[MemberEN$]");
- con.Close();
- DataTable dt = new DataTable();
- dt = ds.Tables["[MemberEN$]"];
- return dt;
-
-
- }
in load event of windows form
combo box Arabic membership and combo box English member ship as following :
- QrClasses qrc = new QrClasses();
- DataTable dt = qrc.ShowExcelDataArabic();
- int c = 0;
- comboBox1.Items.Insert(0, "???? ?????");
- comboBox1.SelectedIndex = 0;
- for (c = 0; c <= dt.Rows.Count - 1; c++)
- {
-
- comboBox1.Items.Add(dt.Rows[c].ItemArray[1]);
- }
-
-
- DataTable dt2 = qrc.ShowExcelDataEnglish();
- int d = 0;
- comboBox2.Items.Insert(0, "Select Member");
- comboBox2.SelectedIndex = 0;
- for (d = 0; d <= dt2.Rows.Count - 1; d++)
- {
-
- comboBox2.Items.Add(dt2.Rows[d].ItemArray[1]);
- }