VB Practical
VB Practical
CENTENARY
COLLEGE,
FARIDABAD
PRACTICAL FILE
Maharshi Dayanand
University,
Rohtak
VISUAL PROGRAMMING
Department of
Bachelor in Computer Application
Submitted By: Submitted To:
TUSHAR KUMAR MR. DINESH KUMAR
1221783011094 ASSISTANT PROFESSOR
2024/2025
Index
Limited; suited for specific tasks or More flexible, suitable for general-
Flexibility
domains purpose applications
2. Form Designer
• Central to VB6.0, the Form Designer allows developers to design the graphical interface of
applications by dragging and dropping controls onto forms.
• Each form represents a window or dialog box in the application.
• Developers can place components like buttons, text boxes, and labels onto forms to define the
appearance and layout of the interface.
3. Toolbox
• A panel that provides a set of pre-defined controls (UI components) that can be added to the
form.
• Common controls include:
o Command Button: Used for clickable actions.
o Text Box: Allows the user to input text.
o Label: Displays static text on the form.
o Combo Box: A drop-down list to select from predefined items.
o List Box: Shows a list of items.
o Picture Box: Allows images to be embedded on the form.
o Timer: Executes code at specified intervals.
o Scrollbar: Provides scrollable functionality for form content.
• Custom controls (ActiveX controls) can also be added to extend functionality.
4. Project Explorer
• Displays all the files and components associated with the current project.
• Shows the hierarchy of forms, modules, and class files within the application.
• Developers can navigate to specific files and open them by double-clicking in the Project
Explorer.
5. Properties Window
• Lists all the properties of the selected control or form.
• Developers can customize controls' attributes, such as size, color, font, position, and name,
without needing to write code.
• Properties update in real-time as changes are made, providing immediate visual feedback.
6. Code Editor
• The area where developers write the VB code to define the application’s logic and behavior.
• Organized by events, such as button clicks, text box input changes, or form loading.
• Supports syntax highlighting, indentation, and basic debugging features.
• Each control on a form has associated event handlers, making it easy to structure code by
actions.
7. Menu Editor
• Allows developers to create custom menus for the application, such as File, Edit, and Help
menus.
• Provides options to set up menu items, define keyboard shortcuts, and create nested submenus.
8. Debugging Tools
• VB6.0 includes a range of debugging tools, such as breakpoints, watches, and the Immediate
Window.
• The Immediate Window allows real-time execution of commands and expressions, useful for
testing code snippets.
• Breakpoints help pause the execution to examine variable states and step through the code.
Advantages of VB6.0
• Ease of Use: The drag-and-drop interface and pre-defined controls make VB6.0 accessible for
developers of all levels.
• Rapid Development: Ideal for quickly prototyping or developing small-to-medium
applications.
• Integrated Development Environment (IDE): The all-in-one IDE provides tools for
designing, coding, and debugging in a single interface.
VB6.0 was a popular choice for Windows applications due to its simplicity and RAD capabilities,
though it has been largely replaced by modern tools such as Visual Basic .NET and other frameworks
for Windows development.
3. Define TextBox, CommandButton, OptionButton, CheckBox, ListBox and
ComboBox with their important properties, events and methods.
Ans. In Visual Basic 6.0, various controls here to interact with users in different ways
1. TextBox
• Description: A TextBox allows users to enter and edit text.
• Properties:
o Text: Holds the text entered in the TextBox.
o MaxLength: Limits the number of characters allowed.
o PasswordChar: Masks the text for passwords.
o Enabled: Determines if the TextBox is active.
o Locked: Prevents editing without disabling it visually.
• Events:
o Change: Triggered when text is changed.
o KeyPress: Detects specific keys pressed while in the TextBox.
o GotFocus / LostFocus: Triggered when the TextBox gains or loses focus.
• Methods:
o SetFocus(): Moves the cursor to the TextBox.
o Clear(): Clears the TextBox content.
2. CommandButton
• Description: A CommandButton is a clickable button used to execute actions.
• Properties:
o Caption: Text displayed on the button.
o Enabled: Enables or disables the button.
o Visible: Controls visibility of the button.
o Default: Sets it as the default button, activated by pressing Enter.
o Cancel: Sets it as the cancel button, activated by pressing Esc.
• Events:
o Click: Triggered when the button is clicked.
o MouseDown / MouseUp: Detects when the mouse is pressed or released.
• Methods:
o SetFocus(): Sets the focus to the button.
o Refresh(): Redraws the button.
3. OptionButton
• Description: An OptionButton (Radio Button) allows users to select one option from a set of
mutually exclusive options.
• Properties:
o Caption: Text label beside the button.
o Value: Determines if the OptionButton is selected (True) or not (False).
o Enabled: Allows or prevents user interaction.
o Visible: Shows or hides the OptionButton.
• Events:
o Click: Triggered when the button is selected.
o GotFocus / LostFocus: Triggered when the OptionButton gains or loses focus.
• Methods:
o SetFocus(): Moves focus to the OptionButton.
o Refresh(): Redraws the OptionButton.
4. CheckBox
• Description: A CheckBox allows users to select multiple options independently (checked or
unchecked).
• Properties:
o Caption: Text label next to the CheckBox.
o Value: State of the CheckBox (Checked, Unchecked, or Grayed).
o Enabled: Enables or disables the CheckBox.
o Visible: Controls visibility of the CheckBox.
• Events:
o Click: Triggered when the CheckBox is selected or deselected.
o GotFocus / LostFocus: Triggered when the CheckBox gains or loses focus.
• Methods:
o SetFocus(): Moves focus to the CheckBox.
o Refresh(): Redraws the CheckBox.
5. ListBox
• Description: A ListBox displays a list of items from which users can select one or more items.
• Properties:
o List: The items contained in the ListBox.
o ListCount: The total number of items in the ListBox.
o ListIndex: Index of the currently selected item.
o MultiSelect: Determines if multiple selections are allowed.
o Enabled: Enables or disables the ListBox.
• Events:
o Click: Triggered when an item is selected.
o DblClick: Triggered on double-click of an item.
o KeyPress: Detects key presses while ListBox is in focus.
• Methods:
o AddItem: Adds a new item to the ListBox.
o RemoveItem: Removes a specified item.
o Clear(): Clears all items from the ListBox.
o SetFocus(): Sets focus to the ListBox.
6. ComboBox
• Description: A ComboBox is a drop-down list that allows users to select an item from a list or
type a custom entry.
• Properties:
o Text: Holds the selected or entered text.
o List: Contains the list of items in the ComboBox.
o ListCount: Number of items in the list.
o ListIndex: Index of the currently selected item.
o Style: Determines the ComboBox style (Drop-down, Drop-down List).
• Events:
o Click: Triggered when an item is selected.
o Change: Triggered when text in the ComboBox changes.
o DblClick: Triggered on double-click of an item.
o KeyPress: Detects key presses within the ComboBox.
• Methods:
o AddItem: Adds an item to the ComboBox.
o RemoveItem: Removes a specified item.
o Clear(): Clears all items in the ComboBox.
o SetFocus(): Moves focus to the ComboBox.
4. Write down different types of Database Connectivity’s and five methods of
Recordset.
Ans. Database Connectivity Types in Visual Basic 6.0 (VB6.0) refer to the various ways the
application can connect and interact with databases to retrieve, update, and manage data. Here are
some common methods of database connectivity in VB6.0:
These methods make it easier to handle and manipulate database records, enabling VB6.0 applications
to perform data operations like adding, updating, navigating, and closing records in a database. Each
method is part of the essential toolkit for interacting with data through a Recordset object.
5. Design a Calculator dialog window
End Sub