Question

I am capable of filling ComboBox with one Datatable. But i am not able to fill the same combobox with another datatable during runtime. First dataTable and Second Datatable contains different Data with Same Columns.

            dtOne= abcd.RetrivData();
            cnsmNm.DataSource = dtOne;
            cnsmNm.DisplayMember = "One_Name";
            cnsmNm.ValueMember = "One_Id";

second datatable

            dtSecond= efgh.RetrivData();
            cnsmNm.DataSource = dtSecond;
            cnsmNm.DisplayMember = "One_Name";
            cnsmNm.ValueMember = "One_Id";
Was it helpful?

Solution

You can use DataTable.Merge method. Like this:

dtOne.Merge(dtSecond);
cnsmNm.DataSource = dtOne;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top