質問

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