Question DataTypes from DataGridView source data...

superservo15

Member
Joined
Apr 25, 2006
Messages
11
Location
Canada
Programming Experience
10+
Hi,
I have another question I'm hoping the wise developers of this forum can help me with.
I have a datatable of data (oRPIRates.GetRates) that is stronglt typed.
I have a datagridview whose data source I set to be the strongly typed table.

VB.NET:
 drgRates.DataSource = oRPIRates.GetRates

However, it seems as soon as the data goes into the datagridview the typing is lost... For example I have a year value that goes in as a "short", however once it's in the datagridview the type is now "double".

I am actually extracting the data right from the datagridview and exporting to an excel file, however I format based on type... and anything that goes in as numeric always seems to come out as a double.

Any ideas how to preserve my typing in the datagridview?
I am stuck on this. Would love to hear what you guys think.
Thanks
 
DataGridView does not change the type of a data value. Verify the datatable columns DataType. How do you determine the type? From a DataGridView cell you can get ValueType property, which corresponds to column data type of the table/view.
 
Back
Top