private void FormBugList_Load(object sender, EventArgs e) { DataTable table = new DataTable(); table.Columns.Add("Bug_id", typeof(int)); table.Columns.Add("Name", typeof(String)); table.Columns.Add("Project", typeof(String)); table.Columns.Add("Package", typeof(String)); table.Columns.Add("Class", typeof(String)); table.Columns.Add("Method", typeof(String)); table.Columns.Add("Line start", typeof(int)); table.Columns.Add("Line end", typeof(int)); table.Columns.Add("Author", typeof(String)); table.Columns.Add("Fix status", typeof(bool)); BugController bugController = new BugController(); List <Bug> allBug = bugController.getAllBug(); foreach (Bug b in allBug) { table.Rows.Add(b.Id, b.BugName, b.ProjectName, b.PackageName, b.ClassName, b.MethodName, b.LineStart, b.LineEnd, b.BugAuthor, b.Status); } myDataGrid.SelectionMode = DataGridViewSelectionMode.FullRowSelect; myDataGrid.MultiSelect = false; myDataGrid.DataSource = table; }