DataGridView throwing Drawing exception when assigning datasource
-
Hello CP, I've run into a problem while working on an interface for the result of raw SQL. The user inputs the raw SQL code and the form renders a result, it's an educational piece of software so nothing too fancy. Now, the problem I have is that after putting the result into a DataTable, it crashes when I pass it as a DataSource for the DataGridView. The database I'm querying is an MSAccess (2003, mdb) database. Oddly enough, it doesn't misbehave (crash) when I'm using an SQLite database. I would like some help since the stacktrace isn't making sense to me.
Quote:
A first chance exception of type 'System.ArgumentException' occurred in System.Drawing.dll System.Transactions Critical: 0 : http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/UnhandledUnhandled exceptionSimpelQL.Net.vshost.exeSystem.ArgumentException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089Parameter is not valid. at System.Drawing.Font.GetHeight(Graphics graphics) at System.Drawing.Font.GetHeight() at System.Drawing.Font.get_Height() at System.Windows.Forms.DataGridViewRow..ctor() at System.Windows.Forms.DataGridView.get_RowTemplateClone() at System.Windows.Forms.DataGridView.RefreshRows(Boolean scrollIntoView) at System.Windows.Forms.DataGridView.RefreshColumnsAndRows() at System.Windows.Forms.DataGridView.OnDataSourceChanged(EventArgs e) at System.Windows.Forms.DataGridView.set_DataSource(Object value) at Proj.Net.MainForm.evt_Exec(Object sender, EventArgs e) in L:\Dev\Proj.Net\MainForm.cs:line 139
The first rule of CListCtrl is you do not talk about CListCtrl - kornman
-
Hello CP, I've run into a problem while working on an interface for the result of raw SQL. The user inputs the raw SQL code and the form renders a result, it's an educational piece of software so nothing too fancy. Now, the problem I have is that after putting the result into a DataTable, it crashes when I pass it as a DataSource for the DataGridView. The database I'm querying is an MSAccess (2003, mdb) database. Oddly enough, it doesn't misbehave (crash) when I'm using an SQLite database. I would like some help since the stacktrace isn't making sense to me.
Quote:
A first chance exception of type 'System.ArgumentException' occurred in System.Drawing.dll System.Transactions Critical: 0 : http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/UnhandledUnhandled exceptionSimpelQL.Net.vshost.exeSystem.ArgumentException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089Parameter is not valid. at System.Drawing.Font.GetHeight(Graphics graphics) at System.Drawing.Font.GetHeight() at System.Drawing.Font.get_Height() at System.Windows.Forms.DataGridViewRow..ctor() at System.Windows.Forms.DataGridView.get_RowTemplateClone() at System.Windows.Forms.DataGridView.RefreshRows(Boolean scrollIntoView) at System.Windows.Forms.DataGridView.RefreshColumnsAndRows() at System.Windows.Forms.DataGridView.OnDataSourceChanged(EventArgs e) at System.Windows.Forms.DataGridView.set_DataSource(Object value) at Proj.Net.MainForm.evt_Exec(Object sender, EventArgs e) in L:\Dev\Proj.Net\MainForm.cs:line 139
The first rule of CListCtrl is you do not talk about CListCtrl - kornman
-
I went a whole lot simpler and it's still throwing exceptions.
private void frm_Shown(object sender, EventArgs e)
{
DataTable t = new DataTable();
t.Columns.Add("a");
t.Columns.Add("b");
t.Rows.Add("a","b");
System.Diagnostics.Debug.Assert(t.IsInitialized == true);
dataGridView1.DataSource = t;
}I have no idea why this is bugging.
The first rule of CListCtrl is you do not talk about CListCtrl - kornman
-
I went a whole lot simpler and it's still throwing exceptions.
private void frm_Shown(object sender, EventArgs e)
{
DataTable t = new DataTable();
t.Columns.Add("a");
t.Columns.Add("b");
t.Rows.Add("a","b");
System.Diagnostics.Debug.Assert(t.IsInitialized == true);
dataGridView1.DataSource = t;
}I have no idea why this is bugging.
The first rule of CListCtrl is you do not talk about CListCtrl - kornman