I have a problem with my datagridview.
And the following happens I have several buttons to load the datagridview.
All these buttons are working correct So datagridview is loading as expected.
Only when i press the right or the left arrow butoon and when then datagridview wil be selected with the arrow buttons then the datagridview will be cleared so all datarows in datagridview are gone.
How can i disable the arrow buttons when datagridview not is focused ?

I have found how to disable the arrow buttons until now its working with the following code

Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As Boolean
        Dim ctl As Control = Me.ActiveControl
        If Not IsNothing(ctl) Then
            If TypeOf ctl Is Button Then
                Select Case keyData
                    Case Keys.Up
                        TabStop = True
                        Return True
                    Case Keys.Right
                        TabStop = True
                        Return True
                    Case Keys.Left
                        TabStop = True
                        Return True

                    Case Keys.Down
                        TabStop = True
                        Return True

                End Select
            End If
        End If

        Return False
    End Function

Thanks for the help or reading my problem.
Hope someone can use it

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.