Remove Row in table

  • Thread starter Thread starter PawelR
  • Start date Start date
P

PawelR

Hello Group,

I've problem with remove row in table.
I've DataTable myTable and display row this table i DataGrid (myGrid).

DataView myView = new DataView();
myView.Table=myTable;
myGrid.DataSource=myView;

Rows in myGrid are sorted.

I've too button [Remove]
My question:
How write OnClik function for button?
How remove selected row (selected in myGrid) from myTable?
myTable.Rows.RemoveAt(myGrid.CurrendRowIndex) not work - index in myGrid
and in myTable after sorted is not equal.

Thx
PawelR
 
You are welcome! Do us³ug! ;-)

Marcin
Dziêki Marcin,
pomog³o

Pozdrawiam Pawe³R


Marcin Grze;bski napisa³:

Hi PawelR,

PawelR wrote:

Hello Group,

I've problem with remove row in table.
I've DataTable myTable and display row this table i DataGrid (myGrid).

DataView myView = new DataView();
myView.Table=myTable;
myGrid.DataSource=myView;

Rows in myGrid are sorted.

I've too button [Remove]
My question:
How write OnClik function for button?
How remove selected row (selected in myGrid) from myTable?
myTable.Rows.RemoveAt(myGrid.CurrendRowIndex) not work - index in myGrid
and in myTable after sorted is not equal.

try:

myView.Delete( [here: selected index from myGrid] );

Regards

Marcin
 
Back
Top