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
 
R

Rick Rothstein [MVP - Visual Basic]

Almost everybody in this newsgroup is using VB6 or lower. While
you may get a stray answer to VB.NET (including VB2003 and VB2005
which has dropped .NET from its name) questions here, you should
ask them in newsgroups devoted exclusively to .NET programming
(the languages are different enough to warrant separate newsgroup
support). Look for newsgroups with either the word "dotnet" or
"vsnet" in their name.

For the microsoft news server, try these newsgroups for Visual
Basic .NET related questions...

microsoft.public.dotnet.languages.vb
microsoft.public.dotnet.languages.vb.upgrade
microsoft.public.dotnet.languages.vb.controls
microsoft.public.dotnet.languages.vb.data

And these for more general .NET questions

microsoft.public.dotnet.general
microsoft.public.vsnet.general

Note: There are many other .NET newgroups (use the first three
"fields" from the last two as templates when searching for them),
but the above ones should get you started.

Rick



Dmitry Akselrod said:
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) =
 
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
 
R

Rick Rothstein [MVP - Visual Basic]

I just noticed you cross-posted to both a VB.NET newsgroup and a
non-VB.NET (that is, classic version of VB) newsgroup. So that it
is clear, my other response to your post was from the
microsoft.public.vb.general.discussion newsgroup. Just so you are
aware, the solution you posted has zero applicability (and
meaning) to the people for whom this newsgroup serves; hence, you
should leave the microsoft.public.vb.general.discussion newsgroup
out of any of your future postings. Thank you.

Rick
 

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