문제

Is there any function in Visual Basic .NET to make a button inside a GroupBox act as the AcceptButton, but only for the other form controls it shares the GroupBox with?

I'm only seeing the option on the main form and there doesn't seem to be anything on the Enter Event.

Has anyone tried writing code for this functionality?

도움이 되었습니까?

해결책

You can try resetting the form's AcceptButton property based on entering and leaving the GroupBox:

Private Sub GroupBox1_Enter(sender As Object, e As EventArgs) _
                            Handles GroupBox1.Enter
  Me.AcceptButton = Button2
End Sub

Private Sub GroupBox1_Leave(sender As Object, e As EventArgs) _
                            Handles GroupBox1.Leave
  Me.AcceptButton = Button1
End Sub
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top