sentDT is a DataTable passed in to a function. It has data in it. The code compiles, but when I run it I get this error:
Dim dt As DataTable
Dim i As Int32
For i = 0 To sentDT.Columns.Count - 1
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
The error occurs on the dt.columns.add line.
What I am trying to do here is create a copy of sentDT columns, without having to write it all out by hand, since there are a good number of columns in this table.