|
-
Dec 13th, 2002, 03:37 PM
#1
Thread Starter
New Member
DataGrid
Hi all,
is there a way, to make a full row selction in the DataGrid ?
THX
NETY
-
Dec 14th, 2002, 12:56 PM
#2
Member
use myDatagrid.Select(RowIndex) to mark the whole row in the CurrentCellChanged-Event
for example:
Private Sub dgBenutzer_CurrentCellChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles dgBenutzer.CurrentCellChanged
Try
' Row markieren
dgBenutzer.Select(dgBenutzer.CurrentRowIndex)
Catch ex As Exception
objError.raiseSysError(Me.Name, "dgBenutzer", "CurrentCellChanged", ex.Message, "")
End Try
End Sub
-
Dec 15th, 2002, 02:03 PM
#3
Thread Starter
New Member
Hi escape0,
THX for the Tip, he works fine!
When I now click in a cell, the Row was selected, but the Cell fells like an Editor Cell. How can i disable this? ( The ReadOnly Property is set to True)
Greetings
NETY
-
Dec 16th, 2002, 03:17 AM
#4
Member
i know... i had the same problem
i have a column which is not shown (width=0) in the grid.
Private Sub dgBenutzer_CurrentCellChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles dgBenutzer.CurrentCellChanged
Try
' Focus in Spalte 0 (nicht sichtbar) setzen
Dim dgCell As DataGridCell
dgCell.ColumnNumber = 0
dgCell.RowNumber = dgBenutzer.CurrentRowIndex
dgBenutzer.CurrentCell = dgCell
' Row markieren
dgBenutzer.Select(dgBenutzer.CurrentRowIndex)
Catch ex As Exception
objError.raiseSysError(Me.Name, "dgBenutzer", "CurrentCellChanged", ex.Message, "")
End Try
End Sub
when the user clicks in a cell the currentcell is changed to the first column of the clicked row - this column is not visible in the grid.
maybe there's an other way to do this but i couldn't get any information concerning this.
bye
robert
-
Dec 16th, 2002, 02:19 PM
#5
Thread Starter
New Member
Hi escape0,
thanks for your try.
For some minutes I´ve got an E-Mail, how to make it:
1. Add the following Line of Code after the 'InitializeComponent()call' :
AddHandler DataGrid1.MouseUp, AddressOf highLightRow
2.
Private Sub highLightRow(ByVal sender As Object, ByVal e As MouseEventArgs)
Dim pt = New Point(e.X, e.Y)
Dim grd As DataGrid = CType(sender, DataGrid)
Dim hit As DataGrid.HitTestInfo = grd.HitTest(pt)
If hit.Type = grd.HitTestType.Cell Then
grd.CurrentCell = New DataGridCell(hit.Row, hit.Column)
grd.Select(hit.Row)
End If
End Sub
That´s it.
Greetings
NETY
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|