Good day all. Has anyone come across the following error. "Column requires a valid Data Type". See attachment. The code runs and produces the expected output in Visual Studio. All imports are present and correct for the script I hope. The message is obviously self explanatory but it doesn't tell me on which line the error is, so with the amount of lines of code I have, that makes it rather difficult to correct the error. Is there a way I can find out which line it's not happy with ?
Just to clarify, the code builds without errors but throws the data type error when it is run.
Regards,
Colin.
Update 1 :
I've used a process of code elimination, so I know what block of code it lies in. See below. I can now at least see where it is. Something to do with the Type.GetType call possibly.
Dim NewColumn As DataColumn = New DataColumn("ExpiryDate")
NewColumn.DataType = Type.GetType("DateTime")
dtWorkingTable.Columns.Add(NewColumn)
And there a quite a few more of these, all with datetime or string specification.
Update 2 :
The following code appears to have stopped the error by explicitly adding system.
Dim NewColumn As DataColumn = New DataColumn("ExpiryDate")
NewColumn.DataType = System.Type.GetType("System.DateTime")
dtWorkingTable.Columns.Add(NewColumn)