VB Default Controls Text Box, Check Box, Option Button - PowerPoint PPT Presentation

1 / 15
About This Presentation
Title:

VB Default Controls Text Box, Check Box, Option Button

Description:

VB Default Controls Text Box, Check Box, Option Button & Frames – PowerPoint PPT presentation

Number of Views:80
Avg rating:3.0/5.0
Slides: 16
Provided by: Comput620
Category:

less

Transcript and Presenter's Notes

Title: VB Default Controls Text Box, Check Box, Option Button


1
VB Default ControlsText Box, Check Box, Option
Button Frames
2
Default Controls
3
Control Function
4
Control Function
5
Other Controls
  • The controls shown are not the only ones included
    with VB. To add other controls such as the
    Microsoft CommonDialog control or Microsoft
    FlexGrid control
  • use the Components dialog box by choosing
    Project, Components, or right-clicking an empty
    area of the Toolbox and selecting Components from
    the context menu.

6
Text Box
  • The AutoSize Property
  • The WordWrap Property
  • New Line (vbCrLf)
  • Label1.caption First Line vbCrLf Second
    Line

7
Text Box
  • Handling Multiple Lines of Text by MultiLine and
    ScrollBar properties.

8
Controls for Making Choices
  • Check Box Switches one or more options on or off
  • Option Button Selects a single choice from a
    group
  • List Box Displays a list of user-defined items
  • Combo Box Like a list box, but also displays
    selected item

9
Check Boxes
  • If chkBan 1 Then
  • lblChoice.Caption "Bannana
  • End If
  • If chkTom 1 Then
  • lblChoice.Caption "Tomato"
  • End If

10
Check Boxes
  • Style Property
  • 0 Standard, 1 Graphical
  • Picture Property
  • set the picture when not checked
  • DownPicture
  • set picture when checked
  • DisabledPicture
  • set picture when disabled or grayed

11
Option Buttons
  • also called radio buttons,
  • they exist in a group, only one of them can be
    selected at a time.
  • To use them
  • Draw a group of option buttons
  • You can give each of them a different name
  • OR you can give them the same name (VB will ask u
    if you want to create a control array answer
    Yes)

12
Option Buttons
  • It can be used in programming in two ways
  • 1. Use the Click event if you want to take an
    action when users select an option. (Control
    Array) Happens Immediately
  • Private Sub optWash_Click(Index As Integer)
  • Select Case Index
  • Case 0
  • MsgBox You selected Normal
  • Case 1
  • MsgBox You selected Heavy Duty
  • Case 2
  • MsgBox You selected Pots and Pans
  • End Select
  • End Sub

13
Option Buttons
  • 2. use an if statement to check their state (no
    control array) Do not Happen Immediately
  • Private Sub cmdStartWash_Click()
  • If optNormal True Then
  • MsgBox You selected Normal
  • Elseif optHeavy True Then
  • MsgBox You selected Heavy Duty
  • Else
  • MsgBox You selected Pots and Pans
  • End If
  • End Sub

14
Option Buttons
  • To have multiple option buttons on a form
    selected at the same time separate the option
    buttons into groups by using container controls
    (frame).

15
Frames
  • A type of control called a container.
  • Containers are controls in which you can draw
    other controls.
  • After you draw a Frame control, you are ready to
    start placing other controls in it. You can place
    any controls you like in the frame (or any other
    container). You can even place containers within
    containers.
  • The only way to move a control from other parts
    of the form into the frame is to cut and paste
Write a Comment
User Comments (0)
About PowerShow.com