public static void DataGridViewDisplayDataTable(DataGridView dataGridView, restDataSet restDataSet, DataTable dataTable) { dataGridView.AutoGenerateColumns = true; int index = restDataSet.Tables.IndexOf(dataTable); dataGridView.DataSource = restDataSet; dataGridView.DataMember = restDataSet.Tables[index].TableName; }
public static void FillComboBox(DataTable dataTable, DataGridView dataGridView, ComboBox comboBox, restDataSet restDataSet, int Col) { int index = restDataSet.Tables.IndexOf(dataTable); string[] combo_box_data = new string[restDataSet.Tables[index].Rows.Count]; int i = 0; foreach (DataRow r in restDataSet.Tables[index].Rows) { combo_box_data[i] = r.Field <int>(Col) + ""; i++; } comboBox.DataSource = combo_box_data; }