Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Enter as default key

Enter as default key

Scheduled Pinned Locked Moved Visual Basic
designquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Emile Jacobs
    wrote on last edited by
    #1

    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:

    H 1 Reply Last reply
    0
    • E Emile Jacobs

      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:

      H Offline
      H Offline
      Hesham Amin
      wrote on last edited by
      #2

      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..

      E 1 Reply Last reply
      0
      • H Hesham Amin

        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..

        E Offline
        E Offline
        Emile Jacobs
        wrote on last edited by
        #3

        Thanx for the help, but unfortunately I am still a beginner in VB.NET! What is the code to set the default property? :confused:

        D 1 Reply Last reply
        0
        • E Emile Jacobs

          Thanx for the help, but unfortunately I am still a beginner in VB.NET! What is the code to set the default property? :confused:

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          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 Sub

          This will force the button to draw itself with the thicker border of the default button. RageInTheMachine9532

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups