views:

7

answers:

1

I am not sure if I am missing something, but for the life of me I cannot get the grid to be editable.

All I am doing is loading a file to a Dictionary, then binding that Dictionary to the grid.

The grid displays the data in the Dictionary, but I cant edit any data in the grid.

I tried changing the modes also:

  1. EditOnEnter
  2. EditOnKeyStroke

And Nada.

Any ideas? PS: I have not done much GUI work in C++, so maybe I am overlooking something.

Here is how I load the grid.

Dictionary<String^, String^>^ data = gcnew Dictionary<String^, String^>();
BindingSource^ bindingSource1 = gcnew BindingSource();

// Read and display lines from the file until the end of the file is reached.
while ( line = sr->ReadLine() )
{
  array<String^>^split = line->Split( chars );    
  data->Add(split[0], split[1]);
}


dataGridView1->DataSource = bindingSource1;
bindingSource1->DataSource = data;

dataGridView1->AutoResizeColumns( DataGridViewAutoSizeColumnsMode::AllCells);

Thank in advance.

A: 

I found the problem. You have to use an update-able source and a Dictionary is not update-able.

Once I changed to a DataTablew, problem solved.

nitefrog