kevinf2349
Technical User
I must be doing something stupid but I can't figure out what it is
If I run the following code asis it works fine:
MsgBox("Add col1")
dt.Columns.Add(New DataColumn(System.String.Format("Column 0", 0), GetType(System.String)))
MsgBox("Add col2")
dt.Columns.Add(New DataColumn(System.String.Format("Column 1", 1), GetType(System.String)))
MsgBox("Add col3")
dt.Columns.Add(New DataColumn(System.String.Format("Column 2", 2), GetType(System.Int16)))
MsgBox("Add col4")
dt.Columns.Add(New DataColumn(System.String.Format("Column 3", 3), GetType(System.Int16)))
MsgBox("Add col5")
dt.Columns.Add(New DataColumn(System.String.Format("Column 4", 4), GetType(System.String)))
' MsgBox("new row")
If I comment out the msgbox statements and run the program it throws the following exception
An unhandled exception of type 'System.NullReferenceException' occurred in Unknown Module.
Additional information: Object reference not set to an instance of an object.
Any idea what I could be doing wrong?
If I run the following code asis it works fine:
MsgBox("Add col1")
dt.Columns.Add(New DataColumn(System.String.Format("Column 0", 0), GetType(System.String)))
MsgBox("Add col2")
dt.Columns.Add(New DataColumn(System.String.Format("Column 1", 1), GetType(System.String)))
MsgBox("Add col3")
dt.Columns.Add(New DataColumn(System.String.Format("Column 2", 2), GetType(System.Int16)))
MsgBox("Add col4")
dt.Columns.Add(New DataColumn(System.String.Format("Column 3", 3), GetType(System.Int16)))
MsgBox("Add col5")
dt.Columns.Add(New DataColumn(System.String.Format("Column 4", 4), GetType(System.String)))
' MsgBox("new row")
If I comment out the msgbox statements and run the program it throws the following exception
An unhandled exception of type 'System.NullReferenceException' occurred in Unknown Module.
Additional information: Object reference not set to an instance of an object.
Any idea what I could be doing wrong?