Results 1 to 5 of 5

Thread: DataGrid

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2002
    Posts
    5

    DataGrid

    Hi all,

    is there a way, to make a full row selction in the DataGrid ?

    THX

    NETY

  2. #2
    Member
    Join Date
    Nov 2002
    Location
    Austria
    Posts
    52
    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

  3. #3

    Thread Starter
    New Member
    Join Date
    Dec 2002
    Posts
    5
    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

  4. #4
    Member
    Join Date
    Nov 2002
    Location
    Austria
    Posts
    52
    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

  5. #5

    Thread Starter
    New Member
    Join Date
    Dec 2002
    Posts
    5
    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
  •  



Click Here to Expand Forum to Full Width