I have created a data grid view, i have also created a data table with values now i want to add the whole data table to data grid view.
creditMemoGrid.Columns[0].Name = "No.";
creditMemoGrid.Columns[1].Name = "Memo #";
creditMemoGrid.Columns[2].Name = "Amount";
DataTable table = new DataTable();
table.Columns.Add("Dosage", typeof(int));
table.Columns.Add("Drug", typeof(string));
table.Columns.Add("Patient", typeof(string));
// Here we add five DataRows.
table.Rows.Add(25, "Indocin", "David");
table.Rows.Add(50, "Enebrel", "Sam");
table.Rows.Add(10, "Hydralazine", "Christoff");
table.Rows.Add(21, "Combivent", "Janet");
table.Rows.Add(100, "Dilantin", "Melanie");
creditMemoGrid.DataSource = table; // no data in data grid