Podcast
Questions and Answers
What is the purpose of option buttons in Visual Basic?
What is the purpose of option buttons in Visual Basic?
Option buttons allow the user to choose only one among the many choices.
How are Option Buttons different from Checkboxes?
How are Option Buttons different from Checkboxes?
Option buttons allow the user to choose only one among the many choices, while checkboxes allow for multiple selections.
Which control is another name for Option Buttons?
Which control is another name for Option Buttons?
- List Box
- Radio Buttons (correct)
- Checkboxes
- Combo Box
Option buttons should be grouped with the use of _____________.
Option buttons should be grouped with the use of _____________.
What property allows users to give a name to each of the option buttons?
What property allows users to give a name to each of the option buttons?
What is the function of the cls
method in the Picture control?
What is the function of the cls
method in the Picture control?
The Image Control has the property autosize
to fit the picture to the sides of the borders.
The Image Control has the property autosize
to fit the picture to the sides of the borders.
What is the purpose of the Timer control's Interval
property?
What is the purpose of the Timer control's Interval
property?
The _________ and _________ scrollbars enable the user to set the value position of a picture on an item at the desired location.
The _________ and _________ scrollbars enable the user to set the value position of a picture on an item at the desired location.
What is the course module focused on?
What is the course module focused on?
What is the course code for the module?
What is the course code for the module?
How can the course packet be further improved?
How can the course packet be further improved?
What is the inquiry about enhancing the course packet?
What is the inquiry about enhancing the course packet?
If True, a menu item can be selected.
If True, a menu item can be selected.
The input box function displays a messagebox that will display a message or prompt with the textbox control when the user enters a value. The syntax for the input box function is $Variable = InputBox(“Prompt”, “Title”, “Default”, Xpos, Ypos)$
. The value entered inside the input box will be the value of the _______ variable.
The input box function displays a messagebox that will display a message or prompt with the textbox control when the user enters a value. The syntax for the input box function is $Variable = InputBox(“Prompt”, “Title”, “Default”, Xpos, Ypos)$
. The value entered inside the input box will be the value of the _______ variable.
Which statement is true about the Progressbar control?
Which statement is true about the Progressbar control?
Match the following Common Dialog Box methods with their corresponding dialog box:
Match the following Common Dialog Box methods with their corresponding dialog box:
What property sets the value to True if the radio button is selected?
What property sets the value to True if the radio button is selected?
Which values are used to represent Checked, Unchecked or Grayed in checkboxes?
Which values are used to represent Checked, Unchecked or Grayed in checkboxes?
What property is used to group related controls on a form?
What property is used to group related controls on a form?
What control presents a list of choices displayed vertically?
What control presents a list of choices displayed vertically?
Dropdown Combo and Simple Combo are the same in appearance.
Dropdown Combo and Simple Combo are the same in appearance.
What is the caption for Form1?
What is the caption for Form1?
What is the caption of Label 1 in Form1?
What is the caption of Label 1 in Form1?
The Timer 1 in Form1 has an interval of 100.
The Timer 1 in Form1 has an interval of 100.
The _ has a minimum value of 0 in Form1.
The _ has a minimum value of 0 in Form1.
Match the following Form names with their captions:
Match the following Form names with their captions:
What are the two ways in which the Save File box is commonly configured?
What are the two ways in which the Save File box is commonly configured?
When saving a file again in the Save configuration, what should appear in the FileName property?
When saving a file again in the Save configuration, what should appear in the FileName property?
What should the user do when closing the Save File box?
What should the user do when closing the Save File box?
What components are used in Form 1 of the flight planner application?
What components are used in Form 1 of the flight planner application?
Which of the following components are used in Form 2 of the flight planner application?
Which of the following components are used in Form 2 of the flight planner application?
What component is used in Form 3 of the flight planner application?
What component is used in Form 3 of the flight planner application?
What is the purpose of the Student Profile Program?
What is the purpose of the Student Profile Program?
List the input options required in the Student Profile Program.
List the input options required in the Student Profile Program.
What are the components used in designing the interface of the Student Profile Program?
What are the components used in designing the interface of the Student Profile Program?
What are the four main criteria in the rubrics for grading the Visual Basic program?
What are the four main criteria in the rubrics for grading the Visual Basic program?
What method does the Picture control support for clearing or erasing text, graphics, or graphics displayed on the screen?
What method does the Picture control support for clearing or erasing text, graphics, or graphics displayed on the screen?
Which file formats are supported by the Picture control for displaying images or pictures?
Which file formats are supported by the Picture control for displaying images or pictures?
The Image control has the property 'autosize' to fit the picture to the sides of the borders.
The Image control has the property 'autosize' to fit the picture to the sides of the borders.
The timer control event happens at a certain time interval measured in ______________.
The timer control event happens at a certain time interval measured in ______________.
Match the following scrollbar properties/methods with their descriptions:
Match the following scrollbar properties/methods with their descriptions:
What is the primary purpose of the Menu Editor in Visual Basic?
What is the primary purpose of the Menu Editor in Visual Basic?
Study Notes
Course Packet 03: Enhancing Program and Object Management
- This course packet introduces students to different controls and objects for data input and output in a Visual Basic application.
- The course packet covers various controls, including option buttons, checkboxes, combo boxes, list boxes, common dialog boxes, and others.
- Students will learn about event procedures of these controls and gain hands-on experience in data manipulation and enhancing the user interface in a Visual Basic application.
Objectives
- Determine the functions and usage of other controls in a program.
- Design a simple gender-inclusive Visual Basic application that uses different controls and has an engineering application.
Course Module: Computer Programming
- A control is an object that can be drawn on a Form object to enable or enhance user interaction with an application.
- Controls are broadly classified as standard controls, ActiveX controls, and insertable objects.
- Standard controls include CommandButton, Label, and Frame controls, which are contained inside an .EXE file and cannot be removed.
- ActiveX controls exist as separate files with .VBX or .OCX extensions.
Controls
- Option Button:
- Allows the user to select one option from a set of choices.
- Also known as radio buttons.
- Grouped using frames, allowing the user to choose only one among the available choices.
- Checkbox:
- Allows the user to choose multiple options from a set of choices.
- Values are set to 1 for true or 0 for false, or 2 for grayed out.
- Frames:
- Provide a way of grouping related controls on a form.
- Affect how option buttons operate within a group.
- Frames can be drawn within other frames.
- Listbox:
- Presents a list of choices displayed vertically in a column.
- A scroll bar appears if the list exceeds the height of the list box.
- Syntax for adding, deleting, and selecting items in a list box is provided.
Properties and Methods
-
Option Button:
- Name: allows the user to give a name to each option button.
- Caption: displays text to a certain option button.
- Value: sets the value to true or false if the button is selected or not.
-
Checkbox:
- Name: allows the user to give a name to each checkbox.
- Caption: displays text to a certain checkbox.
- Value: sets the value to 1 for true, 0 for false, or 2 for grayed out.
-
Frames:
- Caption: title information at the top of the frame.
- Font: sets font type, style, and size.
-
Listbox:
- AddItem: procedure to add items inside the list box.
- Clear: procedure to remove all items from the list box.
- Index: specifies the control array index.
- List: returns/sets the items contained in a control's list portion.
- ListCount: contains the number of items inside the list box.
- ListIndex: returns the number of the most recently selected item in the list.
- MultiSelect: controls how items may be selected.
- RemoveItem: procedure for removing or deleting an item inside the list box.
- Selected: array with elements set equal to true or false, depending on whether the corresponding list item is selected.### List Box and Combo Box
-
List box and combo box are two types of controls that present a set of choices to the user, displayed vertically in a column.
-
The main difference between the two is the appearance of the control: the combo box includes a text box on top of a list box and only allows the selection of one item.
-
Syntax for adding an item to a list box or combo box:
controlname.AddItem list
-
Syntax for deleting an item from a list box or combo box:
controlname.RemoveItem controlname.ListIndex
-
Syntax for deleting all items from a list box or combo box:
controlname.Clear
Combo Box Properties
AddItem
: adds an item to the list boxClear
: removes all items from the list boxIndex
: specifies the control array indexList
: returns/sets the items contained in a control's list portionListCount
: contains the number of items inside the combo boxListIndex
: returns the number of the most recently selected item in the listRemoveItem
: removes an item from the list boxSelected
: returns an array with elements set equal to True or False, depending on whether the corresponding list item is selectedSorted
: sorts the list inside the control in ascending orderStyle
: specifies the style of the combo box (Dropdown Combo, Simple Combo, or Dropdown List)
Picture Control
- Used to display images or pictures in a program
- Supports many graphic formats, including bitmaps, GIF, JPEG, and metafiles
- Syntax for loading a picture:
Picturebox.Picture = LoadPicture(“Path and Filename”)
- Syntax for unloading a picture:
Picturebox.Picture = LoadPicture(“”)
- Syntax for clearing the picture:
Picturebox.cls
Image Control
- Similar to the picture control, but with fewer methods
- Loads pictures faster and consumes less memory space and system resources
- Supports bitmaps, JPEG, and GIF images
- Does not have the autosize property, instead uses the stretch property
- Syntax for loading and unloading pictures is the same as for picture control
Timer Control
- A control that is not visible at runtime
- Uses only one event, which is the Timer() event
- The event happens at a certain time interval, measured in milliseconds
- Property/Method:
Interval
(sets the time interval for the event)
Scrollbar
- There are two types of scrollbars: vertical and horizontal
- Enables the user to set its value to position a picture on an item at the desired location
- Properties/Methods:
LargeChange
: returns/sets the maximum amount of change to the value property in a scrollbarSmallChange
: returns/sets the minimum amount of change to the value property in a scrollbarMax
: returns/sets a scrollbar position's maximum value property settingMin
: returns/sets a scrollbar position's minimum value property setting
Multiple Forms
- Used when a program needs two or more forms
- Loading and unloading functions are important in multiple forms
- Properties/Methods:
Load
: loads a form into memoryShow
: displays a form on the screenUnload
: unloads a form from memoryHide
: hides a form on the screen, but it is still loaded in memory
Menus
- A group of related commands
- Can be created using the Menu Editor
- Menu structure is a hierarchical list of command buttons
- Each menu item has a Click event associated with it
- Properties/Methods:
Caption
: the text that appears in the menu barName
: the control name for each menu itemIndex
: used for indexing any menu items defined as control arraysShortcut
: assigns a shortcut keystroke to a menu item
Input Box Function
- Displays a messagebox with a prompt and a textbox
- Syntax:
Variable = InputBox(“Prompt”, “Title”, “Default”, Xpos, Ypos)
- Arguments:
Prompt
: the message displayed inside the input boxTitle
: the title of the input boxDefault
: the default message displayed inside the textboxXpos, Ypos
: the coordinates where the input box will appear on the screen### Toolbar and Imagelist
- The toolbar is a control located below the menu bar, consisting of a collection of buttons that serve as shortcuts to menu bar commands.
- Imagelist is a control used to hold pictures for other controls, and is not visible at runtime.
- To insert a picture inside a toolbar, an imagelist must be added inside the form.
Statusbar
- The statusbar is a control located at the bottom of an application's window, used to display the status of the user's work and actions.
- The
Statusbar.Panels(n)
property is used to set the statusbar's panels, wheren
is the index of the panels. - To insert panels, right-click on the statusbar control and choose the property, then select the Panels tab to set the number of panels needed.
Common Dialog Boxes
- Common dialog boxes provide a standard interface for common operations in Windows-based applications.
- Visual Basic provides a set of common dialog boxes, including Open and Save As dialog boxes.
- The Common Dialog control is a custom control that requires additional files to be used.
- If the common dialog box does not appear in the Visual Basic toolbox, it can be added by selecting Components under the Project menu and clicking on Microsoft Common Dialog Control.
Common Dialog Box Methods
- There are five 'Show' methods to invoke the common dialog box at runtime:
ShowOpen
: displays the Open dialog boxShowSave
: displays the Save As dialog boxShowColor
: displays the Color dialog boxShowFont
: displays the Font dialog boxShowPrinter
: displays the Printer dialog box
Open Common Dialog Box
- The Open common dialog box allows users to specify the name of a file to open.
- The
ShowOpen
method is used to display the dialog box. - Properties of the Open common dialog box include:
CancelError
: generates an error if the Cancel button is clickedDialogTitle
: sets the title of the dialog boxFileName
: sets the initial file name and returns the selected file nameFilter
: restricts the filenames that appear in the file list boxFilterIndex
: indicates which filter component is the default
Save As Common Dialog Box
- The Save As common dialog box allows users to specify the name of a file to save.
- The
ShowSave
method is used to display the dialog box. - Properties of the Save As common dialog box include:
CancelError
: generates an error if the Cancel button is clickedDialogTitle
: sets the title of the dialog boxFileName
: sets the initial file name and returns the selected file nameDefaultExt
: sets the default extension of a file nameFilter
: restricts the filenames that appear in the file list boxFilterIndex
: indicates which filter component is the default
Save File Configuration
- The Save File box can be configured in two ways:
- Save As configuration: used when saving a file for the first time, with a default file name in the
FileName
property - Save configuration: used when saving a file again, assuming the file has been previously opened with a name
- Save As configuration: used when saving a file for the first time, with a default file name in the
- When closing the Save File box, the application should check the returned file name to ensure it meets the required specifications before saving the file.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Description
Understanding the purpose and properties of Option Buttons in Visual Basic, including their differences from Checkboxes and how to group them.