Visual Basic Programming

Page 5

Now that we have access keys set up, we will now put them to use. The command button's access keys work just fine, but labels are not very responsive tools. However, the access keys on the labels enable the user to press and hold Alt +  the labels access key, which jumps to the next active object. In this case, the text boxes. In order to get this to work properly, we need to set up a tab index, which determines the sequence that the form objects will have focus. Focus is simply what an object has in order for the user to interact with the application through that object. With that said:

  • Set the form objects tabIndex Property as follows:

    • lblName: 0

    • txtName:1

    • lblAddress: 2

    • txtAddress: 3

    • lblCity: 4

    • txtCity: 5

    • lblState: 6

    • txtState: 7

    • lblZip: 8

    • txtZip: 9

    • lblSheetrock: 10

  • txtSheetrock: 11

  • lblBlueboard: 12

  • txtBlueboard: 13

  • lblSheetrockPrice: 14

  • txtSheetrockPrice: 15

  • lblBlueBoardPrice: 16

  • txtBlueBoardPrice: 17

  • cmdCalc: 18

  • cmdPrint: 19

  • cmdClear: 20

  • cmdExit: 21

We need to set the startup form. When multiple forms are part of a project, the startup form is usually the form that the project starts with.

If you run the application, you notice that you can tab through only the text boxes and command buttons. Remember: You can press Alt + the access key to give the focus to a command button or text box. The text box's access key is the underlined letter in the label to the left of it.

Now its about time we get this thing working! Go on to Page 6 to learn how.

Back to Top

Page 1 | Page 2 | Page 3 | Page 4 | Page 5 | Page 6 | Page 7 | Page 8 | Page 9 | Page 10 | Page 11

Page 12 | Page 13 | Page 14 | Page 15 | Page 16 | Page 17 | Page 18 | Page 19 | Page 20

Page 21 | Page 22 | Page 23 | Page 24 | Page 25 | Page 26 | Page 27 | Page 28 | Page 29 | Page 30