473,387 Members | 1,876 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.

Winforms Datagrid multiselect sort problem

I want to change one field of all selected rows to a provided value.

Problem 1
I am using the Binding Manager Base to bind the datagrid to the
appropriate dataTable as recommended by KB817247.
It works in all cases but one. If the field being changed is also one
the user has selected as a sort column, then all but the first
selections are missed. If I remove the sort from that column before
or after

binding with the Binding Manager Base, all selections are lost. Am I
wrong in assuming that once bound, I can use the index from the
bindingManager within the dataGrid? If so, how do I associate

mulit-selected rows with data when sorting is used?

Problem 2
If I use the Binding Manager to iterate through the rows to determine
which is selected, Datagrid.getChanges (modified) returns with all
rows modified.

Problem 3
Using the Binding Manager to iterate through the rows, causes each row
to be selected within DataGrid, so user sees scroll effect.
Minor but annoying.

Code Sample:
//dgVirtualDevices is a DataGrid
DataView workTableView = workTable.DefaultView;
dgVirtualDevices.DataSource = workTableView;

string name = frmNewSource.ReturnText;
BindingManagerBase bm = BindingContext[this.workTableView];
for(bm.Position = 0; bm.Position < bm.Count-1; bm.Position++)
{
if(dgVirtualDevices.IsSelected(bm.Position))
{
DataRowView selected = (DataRowView)bm.Current;
//if new name is different than old name
if (selected[sourceColName].ToString() != name)
{
//change name and select to update historical data
selected[updatedSourceColName] = name;
selected[updateHistoricalColName] = true;
selected.EndEdit();
}
}
}
I appreciate any insight on this.

Thanks

Tom Hughes
Jul 21 '05 #1
0 1819

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

Similar topics

6
by: Erald Kulk | last post by:
is it possible to turn off the multiselect in a Datagrid? if yes, how? Erald Kulk
3
by: Dave Veeneman | last post by:
I am just getting into the WinForms data grid, and just about everything I am seeing on it seems to say that the grid must be bound to an ADO.Net dataset. I want to use the grid as a simple unbound...
2
by: Chris Plowman | last post by:
Hi all, I was wondering if anyone can help me with a really annoying problem I have been having. I made a derived datagrid class that will select the row when a user clicks anywhere on a cell...
0
by: Sergiu Cojocaru | last post by:
How can I immediately sort a bool column in a datagrid in winforms by clicking the column header? As I see after I check(uncheck) a row and then press the header to sort the column, the respective...
7
by: BobAchgill | last post by:
I am trying to decide which of these controls to use to implement letting my user select a full row from MyList. The MyList has several columns which would be nice to sort by at run time. The...
3
by: Tom S. | last post by:
VS.Net 2003 V 7.1.3088 ..Net Framework V 1.1.4322 SP1 WinXP SP2 I have a WinForms project that I'm having trouble with. I have a custom user control ( all code based, no visual ) and another...
0
by: Tom Hughes | last post by:
I want to change one field of all selected rows to a provided value. Problem 1 I am using the Binding Manager Base to bind the datagrid to the appropriate dataTable as recommended by KB817247....
0
by: Dino Chiesa [Microsoft] | last post by:
If you develop WinForms or WebForms clients that consume webservices, and display the results in a DataGrid, you may be interested in a helper class I found recently. It is the CollectionView...
2
by: Joseph Ferris | last post by:
Hello, Is it possible to retrieve and set the sort order for a DataGrid control on a WinForm? I had a user request this functionality, and I can't seem to find a place to set and retrieve it...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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,...

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.