I tried searching here for an answer to what would seem a common problem but have found nothing. I am using .Net 2.0 with VC++2005. I create a DataTable with columns that have names that differ only by case. The DataTable distinguishes them just fine but when I associate it to a DataGridView, the latter displays the contents of the first column in the second column. Here is some code to make this clearer:
private: System::Windows::Forms::DataGridView^ DGV_Test;
/.../
DataTable
^DTTest;private: System::Void OnLoad(System::Object^/*sender*/, System::EventArgs^/*e*/){
^NRow;DataRow
DTTest
=gcnew DataTable;DTTest
->Columns->Add("NAME", Type::GetType("System.String"));DTTest
->Columns->Add("Name", Type::GetType("System.Single"));NRow
= DTTest->NewRow();NRow
["NAME"]="Text data";NRow
["Name"]=0.123f;DTTest
->Rows->Add(NRow);DGV_Test
->DataSource = DTTest;}
The result is:
NAME Name
Text data Text data
and not:
NAME Name
Text data 0.123
as it should be.
I have been reading the documentation but I am not finding anything. What is this due to and what solutions would you recommend? Thanks.
Kamen