I am having trouble with data types
Posted on 2003-11-24
I am coding the UpdateCommand of a DataGrid in a VB.NET Webform.
I am having trouble with data types.
Specifically, the following statement works fine except that I don't want to read Cells(5).
Dim ModelIDText As TextBox = CType(e.Item.Cells(5).Controls(0), TextBox)
When I replace Cells(5) with Cells(1), I get the following error:
[InvalidCastException: Specified cast is not valid.]
Cells(5) in my datagrid is type string
Cells(1) in my datagrid is type integer
How do I get ModelID to have the integer value of Cells(1)?