0

hello
in DataGridView1 control there is 3 items i want when you for etc
select item , "number 1" then do something like when i use listbox selected item

If ListBox1.SelectedItem = "1" Then
          textbox1.text="hello"
        end if

if
like
if DataGridView1.selected item ?

Edited by gozo12: n/a

3
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by Jx_Man
0

Select the DataGridView in designer mode and examine the entries under the Events tab in the properties panel. You will see events like

CellClick
CellEnter
CellLeave
etc.

One of them should be what you are looking for.

2

An example :

Private Sub DataGridView1_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick
    Dim i As Integer = DataGridView1.CurrentRow.Index
    With DataGridView1
            If DataGridView1.Item(0, i).Value = "1" Then
                textbox1.text="hello"
            End If 
    End With
End Sub
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.