Salaam to everyone!
dear i am having a problem
i am having a form and datagridview
now the problem is that when form load and iam write something like saniplast so data of datagriview select similar saniplast when i pressed enter so the datagridview_keypress coding cannot execute here is coding

DGvie_Keypress(by. . . . . ...something code or pe. . . .. )

if e.keycode=keys.enter
form2.textbox1.text=dgvie.currentrow.cells("ProductId").value
form1.close()
end if

now the problem is that when i pressed enter so the second row of datagridview is selected and heres product id is assign to form2 textbox
i want to disable the datagridview press enter to move next row
please help me

Private Sub DataGridView1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles DataGridView1.KeyDown
        If e.KeyCode = Keys.Enter Then
            e.Handled = True  '<------
        End If
End Sub

its works
but problem is that when i move arrow key up or down its start from 1st row

dim rowIndex as integer
 rowIndex = GrdTaskAllocation.CurrentCell.RowIndex
 GrdTaskAllocation.Rows(rowIndex).Selected = True

This will select the row you have clicked.
Hope this helps you...
All the best

if you want to disable full or all colums of datagrid than do enable =false.

and if you want to do disable some of many columns than go to collection property and than select individual columan and turn their enable property on the basis of you required in vb.net

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.