473,396 Members | 1,866 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,396 software developers and data experts.

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 1687
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
misunderstanding, 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.PositionChanged event to
achieve this. Here is an example:

private void Form1_Load(object sender, System.EventArgs e)
{
CurrencyManager cm =
(CurrencyManager)this.BindingContext[this.dataSet11.Employees];
cm.PositionChanged +=new EventHandler(cm_PositionChanged);
}

private void cm_PositionChanged(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.microsoft.com> wrote in message
news:sK**************@cpmsftngxa10.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
misunderstanding, 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.PositionChanged event to
achieve this. Here is an example:

private void Form1_Load(object sender, System.EventArgs e)
{
CurrencyManager cm =
(CurrencyManager)this.BindingContext[this.dataSet11.Employees];
cm.PositionChanged +=new EventHandler(cm_PositionChanged);
}

private void cm_PositionChanged(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**************@TK2MSFTNGP10.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.microsoft.com> wrote in message
news:sK**************@cpmsftngxa10.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
misunderstanding, 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.PositionChanged event to achieve this. Here is an example:

private void Form1_Load(object sender, System.EventArgs e)
{
CurrencyManager cm =
(CurrencyManager)this.BindingContext[this.dataSet11.Employees];
cm.PositionChanged +=new EventHandler(cm_PositionChanged);
}

private void cm_PositionChanged(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 misunderstanding. 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.microsoft.com> wrote in message
news:rF**************@cpmsftngxa10.phx.gbl...
Hi Barry,

I think the names of methods lead to misunderstanding. 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
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...
5
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...
3
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...
5
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...
1
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
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...
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...
3
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...
2
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...
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: 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: 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
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...
0
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...
0
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,...

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.