2 Replies - 260 Views - Last Post: 02 December 2019 - 01:57 PM Rate Topic: -----

#1 dimdim80   User is offline

  • D.I.C Head

Reputation: -2
  • View blog
  • Posts: 107
  • Joined: 28-December 08

vbnet datagrid get first cell value by moving with cursor keys

Posted 02 December 2019 - 01:32 PM

i have declared a datagridview1 as datagrid.

when i double click i get the speiciied values.My question is this: How use the cursor keys to display the selected values withount double click the row. Thank you in advance

Private Sub DataGridView1_CellContentClick(sender As System.Object, e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
        Dim row As DataGridViewRow
        If e.RowIndex.ToString > -1 Then 'This line allows filtering and sorting datagrid
            row = Me.DataGridView1.Rows(e.RowIndex)
            idNo = row.Cells("id").Value.ToString
            nm = row.Cells("name").Value.ToString
            srnm = row.Cells("surname").Value.ToString
            dtm = row.Cells("datetime").Value.ToString
            Label1.Text = nm + "  " + srnm + "  " + dtm

        End If
    End Sub


This post has been edited by dimdim80: 02 December 2019 - 01:32 PM


Is This A Good Question/Topic? 0
  • +

Replies To: vbnet datagrid get first cell value by moving with cursor keys

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15477
  • View blog
  • Posts: 62,007
  • Joined: 12-June 08

Re: vbnet datagrid get first cell value by moving with cursor keys

Posted 02 December 2019 - 01:50 PM

In the designer you can right click on your control -> properties. In the property pane click on the lightening bolt for all events associated with that control.

Options like 'selection change' may work as well as inferring a change of 'selected cell' happens with aq 'key down/key press/key up' event.
Was This Post Helpful? 1
  • +
  • -

#3 dimdim80   User is offline

  • D.I.C Head

Reputation: -2
  • View blog
  • Posts: 107
  • Joined: 28-December 08

Re: vbnet datagrid get first cell value by moving with cursor keys

Posted 02 December 2019 - 01:57 PM

View Postmodi123_1, on 02 December 2019 - 01:50 PM, said:

In the designer you can right click on your control -> properties. In the property pane click on the lightening bolt for all events associated with that control.

Options like 'selection change' may work as well as inferring a change of 'selected cell' happens with aq 'key down/key press/key up' event.

T




Thanks!!!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1