.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Imran Ghani
Sohaib Khalid

Home >> Forum >> VB.Net >> Post New QuestionBookmark and Share Subscribe to Forum

Datagridview Keydown -enter key is not working properly

Posted By: Maggi     Posted Date: August 12, 2011    Points:5   Category :VB.Net
handCheck1 = Me.dgCotation.CurrentCell.ColumnIndex
If handCheck1 = 5 Then
If e.KeyCode = 13 Then

dgCotation.Rows(dgCotation.CurrentRow.Index).Cells(7).Value = CDbl(dgCotation.Rows(dgCotation.CurrentRow.Index).Cells(5).Value) * CDbl(dgCotation.Rows(dgCotation.CurrentRow.Index).Cells(6).Value)

End If
End If

Author: Gowthammanju             
Posted Date: August 17, 2011     Points: 20   

try these code which handles handle KeyDown event as

Private Sub dgv_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) _
Handles dgv.KeyDown
If e.KeyCode = Keys.Delete Then
Dim title As String = "Confirm"
Dim message As String = "really delete row?"
Dim bt As MessageBoxButtons = MessageBoxButtons.OKCancel
If MessageBox.Show(message, title, bt) = Windows.Forms.DialogResult.Cancel Then
e.Handled = True
End If
End If
End Sub

Thanks & Regards,

Mark if the answer is true
Author: Narayanan             
Posted Date: August 06, 2012     Points: 20   

Try This Code...
If e.KeyCode= Keys.Enter
// Your Code
End if

Regards, Lakshmi Naraayanan.S

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend