Repost: VS2005 - is DataGrid.IsSelected( ) broken ? (still an MS 'managed' group?)

F

frostbb

The following code works great in C# Net 1.0 & Net 1.1 apps ... doesn't work
for Net 2.0 apps.

Cannot get pDg.IsSelected(i) to toggle to 'true' for 'highlighted' rows in a
DataGrid control.


private int CountSelectedDataGridRows(DataGrid pDg)
{
int i = 0;
int iSelectedRowCount = 0;

CurrencyManager cm =
(CurrencyManager)this.BindingContext[pDg.DataSource, pDg.DataMember];
DataView dv = (DataView)cm.List;

for (i = 0; i < dv.Count; ++i)
{
if ( pDg.IsSelected(i) )
{
++iSelectedRowCount;
}
}

return iSelectedRowCount;
}

Any help would be greatly appreciated. We are MSDN Universal subscribers.
Does MS still monitor this group?

Thanks in advance.

Barry
in Oregon
 
M

Mel

You should use the new DataGridView in 2..0. There is a property called
SelectedRows which return a collection.
 
F

frostbb

Aaaaaah Sigh.

My earlier post explained why we're not in a position to use the
DataGridView. We're in the midst of huge migration and all we have time to
do is migrate our old apps from .Net 1.0 / 1.1 to .Net 2.0 for the most part
everything working. However, porting all the drag drop stuff to the new
DataGridView is not an option at this point.

However, thanks for taking the time to answer.

Barry
in Oregon

Mel said:
You should use the new DataGridView in 2..0. There is a property called
SelectedRows which return a collection.

frostbb said:
The following code works great in C# Net 1.0 & Net 1.1 apps ... doesn't
work for Net 2.0 apps.

Cannot get pDg.IsSelected(i) to toggle to 'true' for 'highlighted' rows
in a DataGrid control.


private int CountSelectedDataGridRows(DataGrid pDg)
{
int i = 0;
int iSelectedRowCount = 0;

CurrencyManager cm =
(CurrencyManager)this.BindingContext[pDg.DataSource, pDg.DataMember];
DataView dv = (DataView)cm.List;

for (i = 0; i < dv.Count; ++i)
{
if ( pDg.IsSelected(i) )
{
++iSelectedRowCount;
}
}

return iSelectedRowCount;
}

Any help would be greatly appreciated. We are MSDN Universal
subscribers. Does MS still monitor this group?

Thanks in advance.

Barry
in Oregon
 

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