Home Forums WinForms controls Xceed Grid for WinForms Determining which row you have just clicked into

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #12668 |

    I can’t seem to find an eventthat will let me determine which row I am currently on. Here’s what I’ve got:

    A grid with 3 columns.
    Column 1 is the data/time the row was entered.
    Column 2 is the UserID of the user that entered the row.
    Column 3 is the Journal Entry.

    I was the user to click into a row and based on whether the current user is the same as the user that entered that row, they can edit the Journal Entry or not.

    I’ve tried both the CurrentRowChanged and CurrentCellChanged events, but they give me into based on the row I’m leaving, not the row I’m entering.

    Another factor is that if the row is a new row, I want the user to be able to enter data into the Journal Entries column.

    Can anyone help me figure this out?

    Imported from legacy forums. Posted by DimondWoof (had 1297 views)

    User (Old forums)
    Member
    Post count: 23064

    Never mind! Appearantly, my mind isn’t focussing very well today. Here is what I did to resolve this:

    Private Sub gcPrimary_SelectedRowsChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles gcPrimary.SelectedRowsChanged
    Dim drRow As Data.DataRow
    Dim drLoop As Data.DataRow
    Dim dv As DataView
    Dim lngRow As Long
    Dim blnRowFound As Boolean

    lngRow = gcPrimary.SelectedValue
    For Each drLoop In m_dtCaseEntries.Rows
    Debug.WriteLine(drLoop.Item(“JournalEntriesID”))
    If drLoop.Item(“JournalEntriesID”) = lngRow Then
    drRow = drLoop
    blnRowFound = True
    Exit For
    End If
    Next

    If blnRowFound Then
    If drRow.Item(2).ToString = clsSQLLogin.UserID.ToString Then
    ‘User matches, so is allowed to edit.
    Me.gcPrimary.ReadOnly = False
    Else
    ‘User doesn’t match, so they can’t edit
    Me.gcPrimary.ReadOnly = True
    End If
    Else
    ‘This means it’s a new entry and anyone should be allowed to type in the field.
    Me.gcPrimary.ReadOnly = False
    End If
    End Sub

    Imported from legacy forums. Posted by DimondWoof (had 3783 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.