Problem when moving rows in dgv by using the currencyManager.

Joined
Aug 6, 2007
Messages
1
Reaction score
0
Dear all,

I met one problem about moving the rows in dgv by using the currencyManager. In my application, there is one dgv, dataSet and XML file. The dvg is bounded with the XML file by using dataSet. There is one "up" button to "UP" the selected row in the dgv. The row that I wanna move is in the dataSet DataTable "a".

rivate void CurrencyManagerforDataTable()
{
MyCurrencyManager = (CurrencyManager)this.BindingContext[dataSet.Tables["a"]];


MyCurrencyManager.Position = dgv.CurrentCell.RowIndex;
}

This function is invoked when the form is loaded.

In "up" button event handler function,

MyCurrencyManager.Position = dgv.CurrentCell.RowIndex;

if (MyCurrencyManager.Position == 0)
{
MessageBox.Show("You're at the beginning of the table.");

}
else
{
MyCurrencyManager.Position -= 1;


MyCurrencyManager.EndCurrentEdit();

}

However, the selected row in the dgv is not moved as it should be.

Can you help me a little with this problem?

Thanks in advance,

Rush hour
 

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