Visual Basic Option Buttons

NourishingGrace1079 avatar
NourishingGrace1079
·
·
Download

Start Quiz

Study Flashcards

43 Questions

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?

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?

Radio Buttons

Option buttons should be grouped with the use of _____________.

frames

What property allows users to give a name to each of the option buttons?

Name property

What is the function of the cls method in the Picture control?

To clear or erase text or graphics displayed on the screen

The Image Control has the property autosize to fit the picture to the sides of the borders.

False

What is the purpose of the Timer control's Interval property?

measures the time for an action to be executed

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?

Computer Programming

What is the course code for the module?

431

How can the course packet be further improved?

Enhanced

What is the inquiry about enhancing the course packet?

How to enhance it

If True, a menu item can be selected.

True

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.

Variable

Which statement is true about the Progressbar control?

It shows progress visually with an animated bar.

Match the following Common Dialog Box methods with their corresponding dialog box:

ShowOpen = Open dialog box ShowSave = Save As dialog box ShowColor = Color dialog box ShowFont = Font dialog box ShowPrinter = Printer dialog box

What property sets the value to True if the radio button is selected?

Value

Which values are used to represent Checked, Unchecked or Grayed in checkboxes?

1 for Checked, 0 for Unchecked, 2 for Grayed

What property is used to group related controls on a form?

Frames

What control presents a list of choices displayed vertically?

Listbox

Dropdown Combo and Simple Combo are the same in appearance.

False

What is the caption for Form1?

Welcome Screen

What is the caption of Label 1 in Form1?

Planner

The Timer 1 in Form1 has an interval of 100.

True

The _ has a minimum value of 0 in Form1.

Progressbar 1

Match the following Form names with their captions:

Form1 = Welcome Screen Form2 = Flight Planner Form3 = System Information

What are the two ways in which the Save File box is commonly configured?

Save As configuration and Save configuration

When saving a file again in the Save configuration, what should appear in the FileName property?

Previously used name

What should the user do when closing the Save File box?

Check the returned file name to ensure it meets the application requirements before saving the file

What components are used in Form 1 of the flight planner application?

2 labels, 1 timer, and 1 progress bar

Which of the following components are used in Form 2 of the flight planner application?

3 labels, 1 listbox, 2 combo box, 1 command button

What component is used in Form 3 of the flight planner application?

1 label

What is the purpose of the Student Profile Program?

To prompt the user to input student information, display it based on selection, and exit the program.

List the input options required in the Student Profile Program.

Student name, gender, year level, status, birthday, student picture, course (with option to add year and course if not in the list).

What are the components used in designing the interface of the Student Profile Program?

1 form, 4 labels, 1 text box, 3 list boxes, 4 combo boxes, 1 picture box, 1 common dialog box, and 6 command buttons.

What are the four main criteria in the rubrics for grading the Visual Basic program?

Functionality, Interface Design, Portability, and Timeliness.

What method does the Picture control support for clearing or erasing text, graphics, or graphics displayed on the screen?

cls

Which file formats are supported by the Picture control for displaying images or pictures?

All of the above

The Image control has the property 'autosize' to fit the picture to the sides of the borders.

False

The timer control event happens at a certain time interval measured in ______________.

milliseconds

Match the following scrollbar properties/methods with their descriptions:

LargeChange = Returns/sets maximum amount of change to value property in a scrollbar when user clicks the scrollbar area. SmallChange = Returns/sets the minimum amount of change to value property in a scrollbar when the user clicks the scrollbar arrow. Max = Return/sets a scrollbar position’s maximum value property setting. Min = Return/sets a scrollbar position’s minimum value property setting.

What is the primary purpose of the Menu Editor in Visual Basic?

Defining the menu structure and assigning access keys and shortcut keys.

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 box
  • Clear: removes 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 combo box
  • ListIndex: returns the number of the most recently selected item in the list
  • RemoveItem: removes an item from the list box
  • Selected: returns an array with elements set equal to True or False, depending on whether the corresponding list item is selected
  • Sorted: sorts the list inside the control in ascending order
  • Style: 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 scrollbar
    • SmallChange: returns/sets the minimum amount of change to the value property in a scrollbar
    • Max: returns/sets a scrollbar position's maximum value property setting
    • Min: 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 memory
    • Show: displays a form on the screen
    • Unload: unloads a form from memory
    • Hide: hides a form on the screen, but it is still loaded in memory
  • 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 bar
    • Name: the control name for each menu item
    • Index: used for indexing any menu items defined as control arrays
    • Shortcut: 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 box
    • Title: the title of the input box
    • Default: the default message displayed inside the textbox
    • Xpos, 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, where n 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 box
    • ShowSave: displays the Save As dialog box
    • ShowColor: displays the Color dialog box
    • ShowFont: displays the Font dialog box
    • ShowPrinter: 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 clicked
    • DialogTitle: sets the title of the dialog box
    • FileName: sets the initial file name and returns the selected file name
    • Filter: restricts the filenames that appear in the file list box
    • FilterIndex: 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 clicked
    • DialogTitle: sets the title of the dialog box
    • FileName: sets the initial file name and returns the selected file name
    • DefaultExt: sets the default extension of a file name
    • Filter: restricts the filenames that appear in the file list box
    • FilterIndex: 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
  • 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.

Understanding the purpose and properties of Option Buttons in Visual Basic, including their differences from Checkboxes and how to group them.

Make Your Own Quizzes and Flashcards

Convert your notes into interactive study material.

Get started for free

More Quizzes Like This

Visual Basic Statements and Controls Quiz
8 questions
Visual Basic Programming Overview
12 questions
Visual Basic Programming
40 questions

Visual Basic Programming

WellRoundedKremlin avatar
WellRoundedKremlin
Use Quizgecko on...
Browser
Browser