473,804 Members | 3,953 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.getCha nges (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:
//dgVirtualDevice s is a DataGrid
DataView workTableView = workTable.Defau ltView;
dgVirtualDevice s.DataSource = workTableView;

string name = frmNewSource.Re turnText;
BindingManagerB ase bm = BindingContext[this.workTableV iew];
for(bm.Position = 0; bm.Position < bm.Count-1; bm.Position++)
{
if(dgVirtualDev ices.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[updatedSourceCo lName] = name;
selected[updateHistorica lColName] = true;
selected.EndEdi t();
}
}
}
I appreciate any insight on this.

Thanks

Tom Hughes
Jul 21 '05 #1
0 1849

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

Similar topics

6
12950
by: Erald Kulk | last post by:
is it possible to turn off the multiselect in a Datagrid? if yes, how? Erald Kulk
3
5309
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 grid-- all I want to do is write to the grid, read from it, and allow the user to enter text in particular cells. Is the WinForms datagrid a viable candidate for this sort of work? If it is, can you recommend a resource to help me get up to...
2
9930
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 (multi-select without modifier keys). I got that working fine, but I also wanted to keep rows selected after a sort, which I do by storing the row's id in an arraylist. The idea was to do the sort and then go back and re-select the rows with that...
0
951
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 row doesn't have it's edit session end, and when sorted, it is not taken into consideration. What should I do?
7
15009
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 MyList data is resident in a dataset table. I'm stuck and can't choose either because. If I choose ListView as my control I don't understand how to programmatically get the data from the dataset table
3
1819
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 class that is a collection of multiple instances of the control. In ASP.NET, if I wanted to bind the data of the collection ( each control having it's own row in the grid ) it was not a problem. I was also able
0
405
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. 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
0
2779
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 class described at: http://dotnetjunkies.com/WebLog/bsblog/archive/2004/09/02/24116.aspx This can help with sorting and filtering of collections, when displayed in a DataGrid. A DataGrid is a powerful data display widget. One of the interesting...
2
1560
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 from. Am I missing something, or is this something that is more difficult to do than is worth the time? Thanks in advance!
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9582
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10580
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10082
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7621
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5652
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4301
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3821
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2993
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.