Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static DataTable ConvertListToDataTable(List<WindowsFormsApplication1.ServiceReference1.ArrayOfString> list)
- {
- // New table.
- DataTable table = new DataTable();
- // Get max columns.
- int columns = list[0].Count();
- // Add columns.
- for (int i = 0; i < columns; i++)
- {
- table.Columns.Add();
- }
- // Add rows.
- foreach (var array in list)
- {
- table.Rows.Add(array);
- }
- return table;
- }
- List <WindowsFormsApplication1.ServiceReference1.ArrayOfString> list = cont.GetAllEmployee();
- DataTable table = ConvertListToDataTable(list);
- dataGridView.DataSource = cont.GetAllEmployee();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement