delete a specific cell in my Datagrid

  • Thread starter Thread starter Michael Schindler
  • Start date Start date
M

Michael Schindler

Hello NG

How I can delete a specific cell in my Datagrid.

I would like if the user is in the column 6 the value changed,
after automaticly the value in the column 7 in the same row to delete.


Thanks

Michael
 
Hello Michael,

If we are talking about the System.Windows.Forms.DataGrid control, one
possible solution could be as follows:

a) Obtain a DataView the grid creates behind the scenes for a bound
DataTable through CurrencyManager instance in turn obtained from the form's
BindingContext property (you should cast the CurrencyManager.List property
to System.Data.DataView)

b) Subscribe to the DataView's ListChanged event, react on ItemChanged
notifications and update the row being changed accordingly.
 
Thank you very much

hmmm....

"and update the row being changed accordingly"

Have you a code example?

Thanks

Michael



Dmitriy Lapshin said:
Hello Michael,

If we are talking about the System.Windows.Forms.DataGrid control, one
possible solution could be as follows:

a) Obtain a DataView the grid creates behind the scenes for a bound
DataTable through CurrencyManager instance in turn obtained from the form's
BindingContext property (you should cast the CurrencyManager.List property
to System.Data.DataView)

b) Subscribe to the DataView's ListChanged event, react on ItemChanged
notifications and update the row being changed accordingly.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

Michael Schindler said:
Hello NG

How I can delete a specific cell in my Datagrid.

I would like if the user is in the column 6 the value changed,
after automaticly the value in the column 7 in the same row to delete.


Thanks

Michael
 
It's just basic operations with a System.Data.DataRowView instance obtained
by the index of the changed item. I don't have an example but this should be
pretty straightforward:

- Obtain a DataRowView instance by the index of the changed item
- Obtain a reference to a System.Data.DataRow instance corresponding to this
DataRowView through its Row property
- Modify the DataRow as you see fit through its indexer, as usual.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

Michael Schindler said:
Thank you very much

hmmm....

"and update the row being changed accordingly"

Have you a code example?

Thanks

Michael



im Newsbeitrag news:[email protected]...
Hello Michael,

If we are talking about the System.Windows.Forms.DataGrid control, one
possible solution could be as follows:

a) Obtain a DataView the grid creates behind the scenes for a bound
DataTable through CurrencyManager instance in turn obtained from the form's
BindingContext property (you should cast the CurrencyManager.List property
to System.Data.DataView)

b) Subscribe to the DataView's ListChanged event, react on ItemChanged
notifications and update the row being changed accordingly.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

Michael Schindler said:
Hello NG

How I can delete a specific cell in my Datagrid.

I would like if the user is in the column 6 the value changed,
after automaticly the value in the column 7 in the same row to delete.


Thanks

Michael
 
Back
Top