Remove Row in table

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
 
?

=?ISO-8859-2?Q?Marcin_Grz=EAbski?=

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
 

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