<CHAPTER 5 CHAPTER TITLE ><#><Some Visual Basic Controls

<CHAPTER 5 CHAPTER TITLE ><#><Some Visual Basic Controls

1 Table of Contents User Interface Design: Visual Basic Controls and Events .......................................................................................5 3.1 Obtaining Open-Ended Input from the User: Text Box and Masked Text Box ...............................................6 Text Property of the Text Box ................................................................................................................................6 Understanding the Focus ...................................................................................................................................8 The Masked Text Box .............................................................................................................................................9 The Mask Property .......................................................................................................................................... 10 Selecting (Highlighting) a Portion of the Text ..................................................................................................... 11 3.2 Arranging Many VB Controls on a Form: Group Box and Tab Controls ............................................................ 14 The Group Box ..................................................................................................................................................... 14 Design Time Behavior ..................................................................................................................................... 15 Placing Controls in a Group Box ...................................................................................................................... 15 Run Time Behavior, Visible Property, and Enabled Property ......................................................................... 16 The Tab Control ................................................................................................................................................... 17 3.3 Data with Limited Number of Choices: Radio Buttons and Check Boxes .......................................................... 21 The Radio Button ................................................................................................................................................ 21 How Radio Buttons Work in Group ................................................................................................................ 21 Check Boxes for Independent Choices ................................................................................................................ 23 Difference in the Click Event Between the Check Box and the Radio Button ................................................ 25 The CheckState Property ................................................................................................................................ 26 3.4 Longer List of Known Items: List Boxes and Combo Boxes ............................................................................... 26 The List Box ......................................................................................................................................................... 26 Populating the List Box ................................................................................................................................... 27 The Items.RemoveAt Method ........................................................................................................................ 28 The Items.Count Property .............................................................................................................................. 29 2 The SelectionMode Property .......................................................................................................................... 29 The Sorted Property ........................................................................................................................................ 29 Versatility of the List Box ................................................................................................................................ 29 The SelectedItem and SelectedIndex Property .............................................................................................. 29 Identifying the Selected Items ........................................................................................................................ 30 The Checked List Box, a Variant ...................................................................................................................... 31 The Need for the Combo Box .............................................................................................................................. 32 Similar Properties ........................................................................................................................................... 32 Similar Methods .............................................................................................................................................. 33 The DropDownStyle Property ......................................................................................................................... 33 Between the List Box and Combo Box ............................................................................................................ 33 3.5 Graphics in the Visual Interface ................................................................................................................... 35 The Picture Box ................................................................................................................................................... 35 Setting the Image Property ............................................................................................................................. 36 The SizeMode Property .................................................................................................................................. 36 Images for Actions .......................................................................................................................................... 36 3.6 VB Controls in the Design of a Data-Entry Interface: Recapitulation .......................................................... 37 3.7 Naming the Controls and Setting the Tab Order ......................................................................................... 38 Naming Convention: Suggested Name Prefixes .................................................................................................. 38 Setting the Tab Order .......................................................................................................................................... 39 3.8 Some Commonly Used Events ..................................................................................................................... 40 Setting the Initial State at Runtime: The Form Load Event ................................................................................. 40 The Click Event: Buttons and List Boxes .............................................................................................................. 41 The CheckedChanged Event: Radio Buttons and Check Boxes ........................................................................... 42 SelectedIndexChanged and DoubleClick Events: List Box and Combo Box ........................................................ 42 3 Combo Box Events .......................................................................................................................................... 43 Viewing the Key Entered: The KeyPress Event .................................................................................................... 44 Before the User Does Anything in a Control: The Enter Event ........................................................................... 45 As the User Leaves the Field: The Leave Event ................................................................................................... 46 Summary of Events ............................................................................................................................................. 47 3.9 The Environ-Pure Project: An Application Example .................................................................................... 47 The Environ-Pure Project .................................................................................................................................... 48 The Visual Interface............................................................................................................................................. 48 Date of Order .................................................................................................................................................. 49 Distributor Number ........................................................................................................................................ 49 Model Number................................................................................................................................................ 49 Quantity Ordered ............................................................................................................................................ 49 Special Instructions ......................................................................................................................................... 50 Buttons and the Form ....................................................................................................................................

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    72 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us