473,387 Members | 1,485 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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

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
May 7 '07 #1
2 1588
Mel
You should use the new DataGridView in 2..0. There is a property called
SelectedRows which return a collection.

"frostbb" <ba***********@remove-this-spam-filter.state.or.uswrote in
message news:uq**************@TK2MSFTNGP04.phx.gbl...
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

May 8 '07 #2
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" <Me************@insdirect.comwrote in message
news:uT*************@TK2MSFTNGP02.phx.gbl...
You should use the new DataGridView in 2..0. There is a property called
SelectedRows which return a collection.

"frostbb" <ba***********@remove-this-spam-filter.state.or.uswrote in
message news:uq**************@TK2MSFTNGP04.phx.gbl...
>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


May 8 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Tom | last post by:
Hi, I have been through all kinds of documentation on the datagrid and dataviews. I have many expensive books that I have looked through. But nothing has really helped. I want to find out and...
0
by: Frank | last post by:
Hello, I use the mouseup event to select a row in a forms datagrid (using the hittest info). I also want to deselect a previously selected row. I thought I use row.isselected, but thats...
6
by: Agnes | last post by:
I understand it is impossible, but still curious to know "Can I freeze several column in the datagrid, the user can only scroll the first 3 columns (not verical), for the rest of the coulumn, it is...
1
by: Jon | last post by:
Question: does datagrid1.isSelected(i) point to the same row as datatable.row(i).delete after datagrid sorted?? I am using datagrid1.isSelected(i) to identify datatable rows that have been...
13
by: pmcguire | last post by:
I have a DataGrid control for which I have also created several new extended DataGridColumnStyles. They behave pretty nicely, but I can't figure out how to implement Selected Item formatting for...
1
by: william_dudek | last post by:
I have a datagrid that is bound to an array of class obects. When I call the routine that deletes the class associated with the selected row of the datagrid, everything works fine except that the...
0
by: frostbb | last post by:
Ok, We've got a bunch of apps that we've migrated from Net 1.0 to Net 2.0. The apps were basically upgraded using the VS2005 migrate. The user control that was using a DataGrid.IsSelected(i)...
0
by: frostbb | last post by:
1st I know about the new DataGridView control. For various reasons we need the IsSelected( ) method of the old DataGrid to work in the upgraded apps. I have a small test app that illustrates the...
3
by: Clive Lumb | last post by:
Hi, I have just got back from vacation and neither of my VS installs work any more. VS2005 gives me a package load failure on microsoft.visualstudio.shell.interop and the web form designer no...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.