datagrid

  • Thread starter Dmitry Akselrod
  • Start date
D

Dmitry Akselrod

Hi,

I am using a standard .NET 1.0 Datagrid. Actually, I am using two, bound to
a master-detail relationship. Both DataGrids are bound to a datasource. I
have the MSDN version of the DateTime picker functioning quite well in the
datagrid. I am also tracking a double-click event within another column in
the datagrid. The column is just text. When the double-click event trigger
fires, I load a borderless form, from which a user can pick an item from a
ListBox control. Once the user picks an item, the item text is entered into
the cell the user double-clicked on.

datagrid1.item(datagrid1.currentrowindex, datagrid.currentcell.colnumber) =
frmPopUp.lbControl1.selectedItem()

I then automatically move the user input to the next cell to the right. The
value from the listbox is entered into the cell. However, the datagrid does
not acknowledge that any changes were made to the dataset. It seems that
the datagrid change detection is bound to user input, such a keyboard event.

I have attempted to surround the datagrid.item property with BeginEdit and
EndEdit methods, to no avail. I have attempted to use CurrencyManager. I
tried incrementing and decrementing currentrowindex values, etc. I just
can't get the datagrid to see that a change was made.

Of course, if you any column values in the same row, such as the
datatimepicker value, a change to the row is detected.

Is there anyway I can get the datagrid to recognize that changes were made
besides writing my own ColumnStyle?

TIA

Dmitry
 
D

Dmitry Akselrod

I was able to solve my problem. I am posting a reply just in case someone
encounters the same issue.

The answer is that you cannot send an "I am editing this control"
notification to the DataGrid without inheriting a Column style in some way
shape or form. The quickest way I found to do this was to inherit the
DataGridTextBoxColumn style and expose the .ColumnStartedEditing protected
method. You can then call a public version of this method in your code.
This will mark the row you are editing as changed.

dmitry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top