Enter as default key
-
When running our project, a login screen pops up before the system can be used. We want to assign the key to the OK button, and the escape key to the Cancel button. Where and how do we set this at design time or programmatically? :confused:
-
When running our project, a login screen pops up before the system can be used. We want to assign the key to the OK button, and the escape key to the Cancel button. Where and how do we set this at design time or programmatically? :confused:
for VB6 : set the OK Button property(default) to True to make Enter the default.. and for Cancel Button set (cancel) to true.. VB.NET: in the form assign the defult button property the name of the OK Button..
-
for VB6 : set the OK Button property(default) to True to make Enter the default.. and for Cancel Button set (cancel) to true.. VB.NET: in the form assign the defult button property the name of the OK Button..
Thanx for the help, but unfortunately I am still a beginner in VB.NET! What is the code to set the default property? :confused:
-
Thanx for the help, but unfortunately I am still a beginner in VB.NET! What is the code to set the default property? :confused:
Be careful how you use the terminology. There is no such thing as a "Default Property" in the .NET Framework. What you are looking for is in the Form Properties. Click on the Form you are using to get the UserName and Password. Under the Misc section in the Properties window you will find AcceptButton and CancelButton. You can assign which button does what and the form will automatically process the ENTER and ESC keys as Accept/OK and Cancel. Now, to get the OK button to LOOK like a Default button you have to call the NotifyDefault method on the button, probably in the Form's Load event, like this:
Private Sub AuthForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
OKButton.NotifyDefault(True)
End SubThis will force the button to draw itself with the thicker border of the default button. RageInTheMachine9532