473,402 Members | 2,064 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,402 software developers and data experts.

How to select a full row in datagrid?

AA
Do anyone know how to select a full row in datagrid instead of a particular
cell?

Whenever user click on a cell, I want to whole row to be selected.

I tried to code that in the cellColumnChange event programmatically that
highlighying the row of the cell.
However, it is strange that the cell will still be hightlighy in differenet
style of the row.

Any idea?

Thx in advance!
Nov 20 '05 #1
3 7209
Private Sub DataGrid1_MouseUp(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles DataGrid1.MouseUp

Dim dg As DataGrid = DirectCast(sender, DataGrid)
Dim ht As DataGrid.HitTestInfo
ht = dg.HitTest(e.X, e.Y)
dg.Select(ht.Row)
End Sub

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"AA" <AA@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Do anyone know how to select a full row in datagrid instead of a particular cell?

Whenever user click on a cell, I want to whole row to be selected.

I tried to code that in the cellColumnChange event programmatically that
highlighying the row of the cell.
However, it is strange that the cell will still be hightlighy in differenet style of the row.

Any idea?

Thx in advance!

Nov 20 '05 #2
the other way may work, but doesnt for me as "dg.Select(ht.Row)" is read only
and cannot assign the row selected to any variable and you dont know which
row you selected. i modified it to this "i = ht.Row" and can read which row i
have.

Dim i As Integer
'commented out - datagrid created in design time
'Dim dg As DataGrid = DirectCast(sender, DataGrid)
Dim ht As DataGrid.HitTestInfo
ht = dg.HitTest(e.X, e.Y)
'commented out - dg.select is read only.
'dg.Select(ht.Row)
' i is the row number to use as see fit
i = ht.Row

hope that helps,
lee holsenbeck

"AA" wrote:
Do anyone know how to select a full row in datagrid instead of a particular
cell?

Whenever user click on a cell, I want to whole row to be selected.

I tried to code that in the cellColumnChange event programmatically that
highlighying the row of the cell.
However, it is strange that the cell will still be hightlighy in differenet
style of the row.

Any idea?

Thx in advance!

Nov 21 '05 #3
What are you talking about ? ' ReadOnly' this is a method which accepts an
argument and selects the row. ht.Row iny returns the index It does work, I
have tested it

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"Lee Holsenbeck" <Le***********@discussions.microsoft.com> wrote in message
news:B6**********************************@microsof t.com...
the other way may work, but doesnt for me as "dg.Select(ht.Row)" is read only and cannot assign the row selected to any variable and you dont know which
row you selected. i modified it to this "i = ht.Row" and can read which row i have.

Dim i As Integer
'commented out - datagrid created in design time
'Dim dg As DataGrid = DirectCast(sender, DataGrid)
Dim ht As DataGrid.HitTestInfo
ht = dg.HitTest(e.X, e.Y)
'commented out - dg.select is read only.
'dg.Select(ht.Row)
' i is the row number to use as see fit
i = ht.Row

hope that helps,
lee holsenbeck

"AA" wrote:
Do anyone know how to select a full row in datagrid instead of a particular cell?

Whenever user click on a cell, I want to whole row to be selected.

I tried to code that in the cellColumnChange event programmatically that
highlighying the row of the cell.
However, it is strange that the cell will still be hightlighy in differenet style of the row.

Any idea?

Thx in advance!

Nov 21 '05 #4

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

Similar topics

4
by: Terry | last post by:
Hey, Having somewhat of an issue, I have a datagrid which is giving me issues. The Datagrid is setup for the user to double click the row, the row is selected and data within that row populates a...
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: Abhishek Dwivedi | last post by:
In my application I am using datagrid to display data. Each DataGridcolumn is of different color.So I am using a class MyTextBoxColumn derived from DataGridTextBoxColumn and overriding base class...
3
by: Erkan KURTULUŞ | last post by:
Hi, How can i select all columns for each row in DataGrid? Best Regards, Erkan
3
by: Zachary Hilbun | last post by:
I'm using a DataGrid control in a web form. I can display it using binding but when I click on any of the items there is no feedback that that row has been selected. I changed SelectedItemStyle...
1
by: Peter van der Veen | last post by:
Hi I've a small porblem when selecting a full row in a datagrid. The datagrid is in readonly mode and i use datagrid1.select(datagrid1.currentrowindex) to select the whole line, but the cell...
5
by: Vik | last post by:
If there are a few Select buttons in a datagrid, is there a way to distinguish in code which button was clicked? Thanks.
3
by: CharlesA | last post by:
Hi folks, I really need help with the following scenario, I'm going to describe as well as a I can what the setup is and what I can't understand I'm using the framework 1.1 using ASP.net with...
0
by: Ramesh R | last post by:
Hi I am using the asp.net 2.0 Datagrid in my webform. How can i select the full row when ever user click the column. If any body knows please reply to me. It's very urgent for me. Thanks
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
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,...
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,...
0
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...

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.