Results 1 to 3 of 3

Thread: set focus on datagrid

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Posts
    471

    set focus on datagrid

    Current I am working on adding new rows to datagrid. After I add a row I hit Enter and want to set focus on the first column of next empty row. how can i get that? thanks.

  2. #2
    Frenzied Member mar_zim's Avatar
    Join Date
    Feb 2004
    Location
    Toledo Cebu City.
    Posts
    1,416
    i found this in the internet

    make a customize datagrid
    and do like this
    VB Code:
    1. Public Class MyDataGrid
    2. Inherits DataGrid
    3. Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As Boolean
    4.         If msg.WParam.ToInt32() = CInt(Keys.Enter) Then
    5.             SendKeys.Send("{Tab}")
    6.             Return True
    7.         End If
    8.         Return MyBase.ProcessCmdKey(msg, keyData)
    9.     End Function
    10. End Class

    hope this helps

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Posts
    471
    Thanks, that is what I want.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width