473,795 Members | 2,452 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 1848

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
5308
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
9927
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
1558
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
9672
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
9519
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
10437
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...
1
10164
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10001
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...
0
9042
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7538
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
5437
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3723
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.