How to visit the invisible column

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ssailor

    #1

    How to visit the invisible column

    I have a datagridview filled with data from an external table.
    I store the Key field in the first column and make it invisible.
    But I want to visit this invisible column to get the Key data when
    I double-click a selected row. How can i do? Thanks in advance.

  • ClayB

    #2
    Re: How to visit the invisible column

    Try code like:

    Dim key as Object = dataGridView1(" HiddenColName",
    e.RowIndex).Val ue

    This assumes you hide the column using

    dataGridView1.C olumns("HiddenC olName").Visibl e = False

    =============== ======
    Clay Burch
    Syncfusion, Inc.

    Comment

    • PlatinumBay

      #3
      Re: How to visit the invisible column

      ssailor,

      When you click on a cell, it should raise a CellClick event.
      http://msdn2.microsoft.com/en-us/lib...cellclick.aspx

      From this event handler, you can get to the row, and then pull the cells by
      index.

      Private Sub dataGridView1_C ellClick(ByVal sender As Object, _
      ByVal e As DataGridViewCel lEventArgs) _
      Handles dataGridView1.C ellClick

      If turn.Text.Equal s(gameOverStrin g) Then Return

      Dim cell As DataGridViewIma geCell = _
      CType(dataGridV iew1.Rows(e.Row Index). _
      Cells(e.ColumnI ndex), DataGridViewIma geCell)
      If (cell.Value Is blank) Then
      If IsOsTurn() Then
      cell.Value = o
      Else
      cell.Value = x
      End If
      ToggleTurn()
      ToolTip(e)
      End If
      If IsAWin() Then
      turn.Text = gameOverString
      End If
      End Sub

      Hope this helps,


      Steve


      "ssailor" <ssailor_wu@hot mail.comwrote in message
      news:1180924213 .345554.234630@ i38g2000prf.goo glegroups.com.. .
      >I have a datagridview filled with data from an external table.
      I store the Key field in the first column and make it invisible.
      But I want to visit this invisible column to get the Key data when
      I double-click a selected row. How can i do? Thanks in advance.
      >

      Comment

      Working...