Kevin,
Thanks for your prompt reply, its very much appreciated. I was hoping that
the datagrid had a better method for tracking when a user highlights a
different set of rows within a datagrid. Oh, well.
With your help here and your answer to my "c# Winforms DataGrid: What's the
difference between highlighted and selected rows ???" question I think I can
set up a mechanism that will allow me to accomplish what I'm trying to do.
Thanks again.
Barry
in Oregon
Kevin Yu said:
Hi Barry,
First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to know what's the event that
is fired when selection in a datagrid has changed. If there is any
misunderstanding, please feel free to let me know.
As far as I know, there is only event fired when the first row of the
selection changes. We can handle CurrencyManager.PositionChanged event to
achieve this. Here is an example:
private void Form1_Load(object sender, System.EventArgs e)
{
CurrencyManager cm =
(CurrencyManager)this.BindingContext[this.dataSet11.Employees];
cm.PositionChanged +=new EventHandler(cm_PositionChanged);
}
private void cm_PositionChanged(object sender, EventArgs e)
{
this.Text = this.dataGrid1.CurrentRowIndex.ToString();
}
However, this only works on the scenario that the first row of the
selection changes. For example, the user changes selection from 12 thru 24
to 45 thru 70. But if he changes 12 thru 24 to 12 thru 18, it will not be
fired.
HTH.
Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."