Home Forums WinForms controls Xceed Grid for WinForms retrieve value from cell for selected row and hidden column

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

    Hi
    I would like to retrieve a value for a cell in a hidden column for the selected row. I have subscribed to the double click event and retrieved the currentrow index but I do not know how to get the value from a specific column. I have pasted the code below. I would like to retieve the value for the LOE_ID column.

    Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    dtProjectDetails = daProjectDetails.GetData()
    GridControl1.DataSource = dtProjectDetails

    GridControl1.ReadOnly = True

    For Each cell As Cell In dataRowTemplate1.Cells
    AddHandler cell.DoubleClick, AddressOf cell_DoubleClick
    Next

    Call SetupGrid()

    End Sub

    Private Sub SetupGrid()

    Dim IDFormatSpecifier As String = “000000000”

    With GridControl1
    .AllowCellNavigation = False
    .Columns(“client_id”).Visible = False
    .Columns(“initiative_id”).Visible = False
    .Columns(“system_id”).Visible = False
    .Columns(“project_status”).Visible = False

    With .Columns(“loe_id”)
    .Title = “ID”
    .Width = 70
    .FormatSpecifier = IDFormatSpecifier
    End With

    With .Columns(“client”)
    .Title = “CLIENT”
    .Width = 120
    End With

    With .Columns(“system_name”)
    .Title = “SYSTEM”
    .Width = 120
    End With

    With .Columns(“system_name”)
    .Title = “SYSTEM”
    .Width = 120
    End With

    With .Columns(“version”)
    .Title = “VERSION”
    .Width = 70
    .FormatSpecifier = IDFormatSpecifier
    End With

    With .Columns(“initiative”)
    .Title = “INITIATIVE”
    .Width = 120
    End With

    With .Columns(“start_date”)
    .Title = “START DATE”
    .Width = 100
    End With

    With .Columns(“status”)
    .Title = “STATUS”
    .Width = 100
    End With

    End With

    End Sub

    Private Sub cell_DoubleClick(ByVal sender As Object, ByVal e As EventArgs)
    Dim row As Xceed.Grid.DataRow = DirectCast(GridControl1.CurrentRow, Xceed.Grid.DataRow)

    If row IsNot Nothing Then

    Dim index As Integer = GridControl1.DataRows.IndexOf(DirectCast(GridControl1.CurrentRow, Xceed.Grid.DataRow))

    End If

    End Sub

    Imported from legacy forums. Posted by Andrew (had 2042 views)

    Xceed Support
    Member
    Post count: 5658

    You just need to put “loe_id” as a parameter of the cell. Also, in the code you sent, the “loe_id” column was visible. However, it does not change anything if you get the value from a visible or an invisible column.

    e.g.,
    <code>
    Private Sub cell_DoubleClick(ByVal sender As Object, ByVal e As EventArgs)
    Dim row As Xceed.Grid.DataRow = DirectCast(GridControl1.CurrentRow, Xceed.Grid.DataRow)

    If row IsNot Nothing Then
    Dim index As Integer = row.Cells(“loe_id”).Value
    End If

    End Sub
    </code>

    Imported from legacy forums. Posted by CharlesB (had 3256 views)

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