473,769 Members | 2,346 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Rows 12 thru 24 are selected in a datagrid. How do I tell when the user selects rows 45 thru 70 ???

I'm using Net 1.1 (2003) SP1 & Windows 2000

Here's the issue ...

Rows 12 thru 24 are selected in a datagrid.

The user now unselects rows 12 thru 24 and selects rows 45 thru 70 ???

How can I tell that the user has reselected a different set of rows in a
datagrid.

I don't see any events at all associated with row selection within a
datagrid.

Thanks in advance!

Barry
in Oregon
Nov 16 '05 #1
6 1720
Hi Barry,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to know what's the event that
is fired when selection in a datagrid has changed. If there is any
misunderstandin g, please feel free to let me know.

As far as I know, there is only event fired when the first row of the
selection changes. We can handle CurrencyManager .PositionChange d event to
achieve this. Here is an example:

private void Form1_Load(obje ct sender, System.EventArg s e)
{
CurrencyManager cm =
(CurrencyManage r)this.BindingC ontext[this.dataSet11. Employees];
cm.PositionChan ged +=new EventHandler(cm _PositionChange d);
}

private void cm_PositionChan ged(object sender, EventArgs e)
{
this.Text = this.dataGrid1. CurrentRowIndex .ToString();
}

However, this only works on the scenario that the first row of the
selection changes. For example, the user changes selection from 12 thru 24
to 45 thru 70. But if he changes 12 thru 24 to 12 thru 18, it will not be
fired.

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 16 '05 #2
Kevin,

Thanks for your prompt reply, its very much appreciated. I was hoping that
the datagrid had a better method for tracking when a user highlights a
different set of rows within a datagrid. Oh, well.

With your help here and your answer to my "c# Winforms DataGrid: What's the
difference between highlighted and selected rows ???" question I think I can
set up a mechanism that will allow me to accomplish what I'm trying to do.

Thanks again.

Barry
in Oregon

"Kevin Yu [MSFT]" <v-****@online.mic rosoft.com> wrote in message
news:sK******** ******@cpmsftng xa10.phx.gbl...
Hi Barry,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to know what's the event that
is fired when selection in a datagrid has changed. If there is any
misunderstandin g, please feel free to let me know.

As far as I know, there is only event fired when the first row of the
selection changes. We can handle CurrencyManager .PositionChange d event to
achieve this. Here is an example:

private void Form1_Load(obje ct sender, System.EventArg s e)
{
CurrencyManager cm =
(CurrencyManage r)this.BindingC ontext[this.dataSet11. Employees];
cm.PositionChan ged +=new EventHandler(cm _PositionChange d);
}

private void cm_PositionChan ged(object sender, EventArgs e)
{
this.Text = this.dataGrid1. CurrentRowIndex .ToString();
}

However, this only works on the scenario that the first row of the
selection changes. For example, the user changes selection from 12 thru 24
to 45 thru 70. But if he changes 12 thru 24 to 12 thru 18, it will not be
fired.

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 16 '05 #3
Kevin,

Thanks for your prompt reply to this and my 2nd question, its very much
appreciated. I was hoping that the datagrid had a better method for
tracking when a user highlights a different set of rows within a datagrid.
Oh, well.

With your help here and your answer to my "c# Winforms DataGrid: What's the
difference between highlighted and selected rows ???" question I think I can
set up a mechanism that will allow me to accomplish what I'm trying to do.

Thanks again.

Barry
in Oregon

P.S. it's very early in the morning here and I mixed up replies to your
responses, I hope you'll fogive me. Best wishes.
"BBFrost" <barry.b.frost@ remove_this.wrd .state.or.us> wrote in message
news:#d******** ******@TK2MSFTN GP10.phx.gbl...
Kevin,

Thanks for your prompt reply, its very much appreciated. I was hoping that the datagrid had a better method for tracking when a user highlights a
different set of rows within a datagrid. Oh, well.

With your help here and your answer to my "c# Winforms DataGrid: What's the difference between highlighted and selected rows ???" question I think I can set up a mechanism that will allow me to accomplish what I'm trying to do.

Thanks again.

Barry
in Oregon

"Kevin Yu [MSFT]" <v-****@online.mic rosoft.com> wrote in message
news:sK******** ******@cpmsftng xa10.phx.gbl...
Hi Barry,

First of all, I would like to confirm my understanding of your issue. From your description, I understand that you need to know what's the event that is fired when selection in a datagrid has changed. If there is any
misunderstandin g, please feel free to let me know.

As far as I know, there is only event fired when the first row of the
selection changes. We can handle CurrencyManager .PositionChange d event to achieve this. Here is an example:

private void Form1_Load(obje ct sender, System.EventArg s e)
{
CurrencyManager cm =
(CurrencyManage r)this.BindingC ontext[this.dataSet11. Employees];
cm.PositionChan ged +=new EventHandler(cm _PositionChange d);
}

private void cm_PositionChan ged(object sender, EventArgs e)
{
this.Text = this.dataGrid1. CurrentRowIndex .ToString();
}

However, this only works on the scenario that the first row of the
selection changes. For example, the user changes selection from 12 thru 24 to 45 thru 70. But if he changes 12 thru 24 to 12 thru 18, it will not be fired.

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."


Nov 16 '05 #4
Hi Barry,

I think the names of methods lead to misunderstandin g. Actually Selected
means the row that mouse is pushed down. The all the rows with blue
backgroud color are highlighted. IsSelected method actually mean
IsHighlighted.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 16 '05 #5
Thanks Kevin,

That's the understanding that I finally reached. I finally ended up passing
thru the data grid 2 times. The 1st time I tagged the 'highlighted' rows
and the 2nd pass I operated on the 'tagged' rows.

Best wishes.

Barry
in Oregon
"Kevin Yu [MSFT]" <v-****@online.mic rosoft.com> wrote in message
news:rF******** ******@cpmsftng xa10.phx.gbl...
Hi Barry,

I think the names of methods lead to misunderstandin g. Actually Selected
means the row that mouse is pushed down. The all the rows with blue
backgroud color are highlighted. IsSelected method actually mean
IsHighlighted.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 16 '05 #6
You're welcome, Barry,

Thanks for sharing your experience with all the people here. If you have
any questions, please feel free to post them in the community.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 16 '05 #7

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

Similar topics

3
2547
by: Diego TERCERO | last post by:
Hi... I'm working on a tool for editing text resources for a family of software product my company produces. These text resources are found in a SQL Server database, in a table called "Resource" with the following structure : Resource{,en,fr,es} Yes.. these are the only languages supported actually. A couple of rows in that table would look like this :
5
14741
by: Mojtaba Faridzad | last post by:
Hi, with SetDataBinding( ) a DataGrid shows a DataView. user can select some rows in the grid by holding cotrol key. when user clicks on Delete button, I should delete all selected rows. I am trying to delete these lines from the dataview like this: for (int i=0; i < dataView.Count; i++) if (dataGrid.IsSelected(i)) dataView.Delete(i);
3
4438
by: BBFrost | last post by:
Ok, I know how to count the number of selected datagrid rows using the code below. What has me stumped is how to determine when the selected rows within a datagrid have been changed. The DataGrid object doesn't seem to have a any type of a selection changed type of event I can grab. THE QUESTION: Does anyone know how to determine when the selected row or set of rows within a datagrid has changed ??? This is driving me nuts !
5
9178
by: BBFrost | last post by:
Win2000 ..Net 1.1 SP1 c# using Visual Studio Ok, I'm currently in a "knock down - drag out" tussle with the .Net 1.1 datagrid. I've come to realize that a 'block' of rows highlighted within a datagrid do >> not << constitute a set of 'selected' records. Apparently one and only one row may be 'selected' in a datagrid. By selected row I mean the row
1
1936
by: Alex K. | last post by:
I need to be able to jump to first selected row in DataGrid. How can I do this without using IsSelected for each row? Is there some sort of collection which contains all selected rows? Thank you.
1
1315
by: Engineerik | last post by:
I have a datagrid which displays rows from a parent datatable. I use a datarelation so the user can expand the child rows. How can I tell programatically when the user has expanded the child rows for a given parent row? How can I tell which if any child rows are selected? I am using dataviews as datasources for the datagrid.
1
4569
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 selected by the user Then I use datatable.rows(i).delete to delete those rows. It works fine if I have not sorted the datatable first. But if
3
2719
by: Brian Tkatch | last post by:
I have a form with two DataGrids, which are kept in sync manually via Stored PROCEDURE calls. That is, when a record is selected on the first grid, a stored PROCEDURE is CALLed to Fill() the next second DataGrid's DataSource. All that works very well. And, when there are no records to display, it is simply left blank. My issue is that when i scroll the first one, sometimes the second grid shows a bunch of null values (a "new" record). ...
2
20078
by: =?Utf-8?B?RGlvZ28gQWx2ZXMgLSBTb2Z0d2FyZSBEZXZlbG9w | last post by:
greetings, I have a datagrid view filled with some data, in that data some of the cells are null and I would like to not let the user select the rows with null values... the problem is that the selection goes there when I click and then jump back to last selected row... the correct behaviour would be stay on the last selected row always until the user select a new valid row...
0
9587
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
9423
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
10211
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
10045
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9993
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
9863
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
7406
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
6672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.