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

Re: highlight user tap row on datagrid by marciocamurati

marciocamurati
Tue Jul 18 14:31:44 CDT 2006

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
[/code]

[]s

Chuck Hecht escreveu:

> 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


Re: highlight user tap row on datagrid by Ilya

Ilya
Tue Jul 18 14:35:25 CDT 2006

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).

"Chuck Hecht" <checht@trakersystems.com> wrote in message
news:eIEP68mqGHA.4760@TK2MSFTNGP03.phx.gbl...
> 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
>
>
>
>