highlight user tap row on datagrid

C

Chuck Hecht

Hello,

All I want to do is highlight the row of a datagrid when ever a user taps
inside the grid. What am I doing wrong



hitinfo = DataGrid1.HitTest(e.X, e.Y)

currentrow = hitinfo.Row

If DataGrid1.CurrentRowIndex = currentrow Then

DataGrid1.CurrentRowIndex = System.Drawing.Color.Goldenrod

End If



Thanks

chuck
 
M

marciocamurati

Hi,

I use this command to make it:

Code:
Private Sub dataGrid_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles dataGrid.Click
Try
If Not dataGrid Is Nothing Then
Dim row As Integer = dataGrid.CurrentCell.RowNumber

dataGrid.Select(row)

row = Nothing
End If
Catch
End Try
End Sub

[]s

Chuck Hecht escreveu:
 
I

Ilya Tumanov [MS]

You're trying to assign color value to the row index. That is similar to
sending a package using recipient's birthday as address.



To highlight row you can select it instead:



DataGrid1.Select(currentrow)



To change color of selected row, please alter these properties:



DataGrid1.SelectionBackColor

DataGrid1.SelectionForeColor

--
Best regards,

Ilya

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

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top