Work with the Properties of a Form or Control


[Page 615 (continued)]

  1. Activate the Properties window.

     

    1.

    Press Alt/V/W.

    or

     

    1.

    Press F4.

    or

     

    1.

    Click on an object on the form with the right mouse button.

    2.

    In the context menu, click on Properties.

  2. Highlight a property in the Properties window.

     

    1.

    Activate the Properties window.

    2.

    Use the up- or down-arrow keys to move the highlight bar to the desired property.

    or

     

    1.

    Activate the Properties window.

    2.

    Click on the up-or-down arrow located at the ends of the vertical scrollbar at the right side of the Properties window until the desired property is visible.

    3.

    Click on the desired property.


  3. [Page 616]
  4. Select or specify a setting for a property.

     

    1.

    Highlight the property whose setting is to be changed.

    2.

    Click on the settings box or press Tab to place the cursor in the settings box.

    a. If a down-arrow button appears at the right end of the settings box, click on the down arrow to display a list of all allowed settings, and then click on the desired setting.

    b. If an ellipsis (three periods: ...) appears at the right end of the settings box, press F4, or click on the ellipsis to display a dialog box. Answer the questions in the dialog box, and click on OK or Open, as appropriate.

    c. If the cursor moves to the settings box, type in the new setting for the property.

  5. Use the Color palette to set foreground and background colors.

     

    1.

    Select the desired control or the form.

    2.

    Press Alt/V/W or F4 to activate the Properties window.

    3.

    To set the foreground color, click on the down-arrow to the right of the ForeColor settings box, click on the Custom tab, and click on the desired color.

    4.

    To set the background color, click on the down-arrow to the right of the BackColor settings box, click on the Custom tab, and click on the desired color.

  6. Let a label change size to accommodate its caption (that is, the setting of its Text property.)

     

    1.

    Keep the label's AutoSize property set to True. (The label will shrink to the smallest size needed to hold the current caption. If the caption is changed, the label automatically will grow or shrink horizontally to accommodate the new caption.)

  7. Let a label caption use more than one line.

     

    1.

    Change the label's AutoSize property setting to False and increase its height. (If the label is not wide enough to accommodate the entire caption on one line, part of the caption will wrap to additional lines. If the label height is too small, then part or all of these additional lines will not be visible.)

  8. Let a text box display more than one line.

     

    1.

    Set the text box's MultiLine property to True. (If the text box is not wide enough to accommodate the text entered by the user, the text will wrap down to new lines. If the text box is not tall enough, lines will scroll out of view, but can be displayed with the cursor up or down keys.)

  9. Assign an access key to a button, check box, or radio button.

     

    1.

    When assigning a value to the Text property, precede the desired access-key character with an ampersand (&).


  10. [Page 617]
  11. Allow a particular button to be activated by a press of the Enter key.

     

    1.

    Set the form's AcceptButton property to the particular button.

  12. Allow the pressing of Esc to activate a particular button.

     

    1.

    Set the form's CancelButton property to the particular button.

  13. Adjust the order in which the Tab key moves the focus.

     

    1.

    Select the first control in the tabbing sequence.

    2.

    Change the setting of the TabIndex property for this control to 0.

    3.

    Select the next control in the tabbing sequence.

    4.

    Change the setting of the TabIndex property for this control to 1.

    5.

    Repeat Steps 3 and 4 (adding 1 to the Tab Index property) until all controls on the form that belong in the tabbing sequence have been assigned a new TabIndex setting with the desired order.

    or

     

    1.

    Press Alt/V/B to show the current tab order. (Each control on the form has a small box in its upper-left corner with a number in it. This number is the TabIndex property setting.)

    2.

    Hover over the first control in the new tabbing sequence. (Notice that the cursor becomes a cross.) Click on the control to change its TabIndex property to 0.

    3.

    Hover over the second control in the new tabbing sequence. Click on the control to change its TabIndex property to 1.

    4.

    Repeat Steps 2 and 3 until all controls on the form that belong in the tabbing sequence have been assigned a new TabIndex setting in the desired order.

    5.

    Press Alt/V/B to hide the tab order numbers.

  14. Change a common property in more than one control.

     

    1.

    Click on the first control.

    2.

    While holding the Ctrl key down, click on the second control.

    3.

    Repeat Step 2 for each additional control.

    4.

    Press F4. (The Properties window is shown.)

    5.

    Click on a property and change its setting.

    Note: Only properties that are available in all of the selected controls (such as background color) may be changed in this manner.

  15. Automatically center the window in the screen when a program executes.

     

    1.

    Click on the form.

    2.

    Press F4. (The properties window is shown.)

    3.

    Click on the StartPosition property.

    4.

    Set the property to CenterScreen.

  16. Change the Name property of Form1 to frmElse.

     

    1.

    In the Solution Explorer, right click on the file Form1.vb.

    2.

    Click on Rename in the context menu that appears.

    3.

    Change the name of the file Form1.vb to frmElse.vb.




An Introduction to Programming Using Visual Basic 2005
Introduction to Programming Using Visual Basic 2005, An (6th Edition)
ISBN: 0130306541
EAN: 2147483647
Year: 2006
Pages: 164

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net