How to implement <TAB> in PropertyGrid in VB

1 Answer 60 Views
PropertyGrid
Henri
Top achievements
Rank 1
Iron
Henri asked on 16 May 2023, 05:18 AM

Hi guys,

I have been searching for a correct answer for that, but without success. It looks like work in C# but not in VB.

I want to implement a TAB between the rows in this sample project. Any idea what is missed?

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 18 May 2023, 02:08 PM

Hello, Henri,

Thank you for the provided sample project. Indeed, when an item in RadPropertyGrid is being edited and the user pressed Tab, the editor doesn't move to the next editable item. 

I believe that the following forum thread is quite useful for achieving your custom requirement: https://www.telerik.com/forums/use-tab-key-to-select-next-property 

I have converted the provided solution to VB and the achieved result is illustrated in the gif file:

Public Class MyPropertyGrid
    Inherits RadPropertyGrid

    Protected Overrides Function ProcessDialogKey(ByVal keyData As Keys) As Boolean
        If keyData = Keys.Tab Then

            If Me.SelectedGridItem IsNot Nothing Then
                Dim traverser As PropertyGridTraverser = New PropertyGridTraverser(Me.PropertyGridElement.PropertyTableElement)

                While traverser.MoveNext() AndAlso Not traverser.Current.Equals(Me.SelectedGridItem)
                End While

                traverser.MoveNext()
                Me.SelectedGridItem = traverser.Current
                Me.BeginEdit()
                Return True
            Else
                Return MyBase.ProcessDialogKey(keyData)
            End If
        Else
            Return MyBase.ProcessDialogKey(keyData)
        End If
    End Function

    Public Overrides Property ThemeClassName As String
        Get
            Return GetType(RadPropertyGrid).FullName
        End Get
        Set(value As String)
            MyBase.ThemeClassName = value
        End Set
    End Property
End Class

I have modified the sample project as well. Please give it a try and see how it works on your end.

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Henri
Top achievements
Rank 1
Iron
commented on 22 May 2023, 12:25 AM

Thanks Dess, everything working fine.
Tags
PropertyGrid
Asked by
Henri
Top achievements
Rank 1
Iron
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or