Visual Basic uses different data types to store numeric and non-numeric data. Numeric data types include Byte, Integer, Long, Single, Double, Currency and Decimal. Non-numeric types include String, Date, Boolean, Object and Variant. Variables are used to store and manipulate data in Visual Basic. Variables must be declared with a name and data type before being used. Common data types for variables include String, Integer, Date and Variant. Variables can be declared individually or on the same line separated by commas.
This document provides an introduction to Visual Basic (VB). It describes VB as an evolved version of BASIC that is visual and event-driven. The VB environment contains a blank form window to design interfaces, a project window to view files, and a toolbox of controls. It also explains how to create a standard executable program in VB and describes the main components of the VB environment.
about visual basic
visual basic 6.0 v/s other version
visual basic programming
form in visual basic
objects in visual basic
important controls
visual basic statement
loop statement
conditional loop
do until loop
This document provides an outline and overview of Chapter 3 from an introduction to Visual Basic programming textbook. It covers simple programs that print text and perform arithmetic, memory concepts, decision making using equality and relational operators, and using dialog boxes to display messages. Example code and screenshots are included to demonstrate key concepts like variables, arithmetic operators, if/then statements, and calling methods.
This document provides an overview of forms and controls in Visual Basic. It discusses:
- Forms are containers that hold controls and are used to design graphical user interfaces. Forms display information and receive user input.
- Common form properties include text, size, location, visibility, and border style.
- Controls like labels, textboxes, buttons are placed on forms. Controls have properties for appearance, location, and behavior.
- Events like clicks, text changes, and focus changes can trigger event handlers - code that executes in response to events. Common form and control events are described.
- An example program demonstrates creating a form with controls, setting control properties, and writing event handlers to
In this chaper we will learn how to change the BackColor property of an object
Understand Visual Basic 2010 code statement formatsand see how IntelliSense can be used to enter code statements.We will discuss the Visual Basic programming languge syntax and write coding statements. We will also see how to correct coding errors in Visual Basic 2010.
Correct errors in Visual Basic 2010 code. We will learn how to print code and how to prepare an Event Planning Document.
This chapter introduces Visual Basic programming and presents simple programs to illustrate key concepts. It discusses printing text, getting user input, performing arithmetic operations, using variables to store and manipulate data, and making decisions using equality and relational operators. The chapter contains code examples with explanations and step-by-step instructions for creating and running programs in the Visual Studio IDE.
Visual Basic is a third-generation event-driven programming language and integrated development environment from Microsoft. It was derived from BASIC and enables rapid application development of graphical user interface applications. Visual Basic allows programmers to create simple GUI applications as well as complex applications. It went through several versions until version 6 in 1998, after which Microsoft's extended support ended in 2008 and it was replaced by Visual Basic .NET.
This document provides an overview of the history and development of the Visual Basic programming language. It discusses how Visual Basic originated from the BASIC language in the 1960s and was later adapted for microcomputers by Bill Gates and Paul Allen in the 1970s. Every version of Basic since has been based on their early work. Visual Basic was then introduced by Microsoft in 1991 and continued to be updated with new features and capabilities in subsequent versions like Visual Basic 3.0, 4.0, 5.0 and 6.0. The document also defines some key Visual Basic concepts and terms.
This document provides an introduction to Visual Basic (VB). It describes VB as an evolved version of BASIC that is visual and event-driven. The VB environment contains a blank form window to design interfaces, a project window to view files, and a toolbox of controls. It also explains how to create a standard executable program in VB and describes the main components of the VB environment.
about visual basic
visual basic 6.0 v/s other version
visual basic programming
form in visual basic
objects in visual basic
important controls
visual basic statement
loop statement
conditional loop
do until loop
This document provides an outline and overview of Chapter 3 from an introduction to Visual Basic programming textbook. It covers simple programs that print text and perform arithmetic, memory concepts, decision making using equality and relational operators, and using dialog boxes to display messages. Example code and screenshots are included to demonstrate key concepts like variables, arithmetic operators, if/then statements, and calling methods.
This document provides an overview of forms and controls in Visual Basic. It discusses:
- Forms are containers that hold controls and are used to design graphical user interfaces. Forms display information and receive user input.
- Common form properties include text, size, location, visibility, and border style.
- Controls like labels, textboxes, buttons are placed on forms. Controls have properties for appearance, location, and behavior.
- Events like clicks, text changes, and focus changes can trigger event handlers - code that executes in response to events. Common form and control events are described.
- An example program demonstrates creating a form with controls, setting control properties, and writing event handlers to
In this chaper we will learn how to change the BackColor property of an object
Understand Visual Basic 2010 code statement formatsand see how IntelliSense can be used to enter code statements.We will discuss the Visual Basic programming languge syntax and write coding statements. We will also see how to correct coding errors in Visual Basic 2010.
Correct errors in Visual Basic 2010 code. We will learn how to print code and how to prepare an Event Planning Document.
This chapter introduces Visual Basic programming and presents simple programs to illustrate key concepts. It discusses printing text, getting user input, performing arithmetic operations, using variables to store and manipulate data, and making decisions using equality and relational operators. The chapter contains code examples with explanations and step-by-step instructions for creating and running programs in the Visual Studio IDE.
Visual Basic is a third-generation event-driven programming language and integrated development environment from Microsoft. It was derived from BASIC and enables rapid application development of graphical user interface applications. Visual Basic allows programmers to create simple GUI applications as well as complex applications. It went through several versions until version 6 in 1998, after which Microsoft's extended support ended in 2008 and it was replaced by Visual Basic .NET.
This document provides an overview of the history and development of the Visual Basic programming language. It discusses how Visual Basic originated from the BASIC language in the 1960s and was later adapted for microcomputers by Bill Gates and Paul Allen in the 1970s. Every version of Basic since has been based on their early work. Visual Basic was then introduced by Microsoft in 1991 and continued to be updated with new features and capabilities in subsequent versions like Visual Basic 3.0, 4.0, 5.0 and 6.0. The document also defines some key Visual Basic concepts and terms.
The document provides information on how to work with Visual Basic (VB), including how to start a VB project, the components of the VB window, how to place controls on a form, set properties, add code to handle events, and develop a basic VB application to display a message. The key steps are to start a new project, place controls like labels and textboxes on the form, set properties like font and color, add code triggered by events, save and run the project to see the output.
1) The document introduces Visual Basic programming and provides examples of simple console applications that demonstrate key features like comments, modules, and procedures.
2) A simple program is shown that displays the text "Welcome to Visual Basic!" to illustrate comments, modules, and sub procedures. Step-by-step explanations of how to create and run the program in Visual Studio are provided.
3) Another simple program is presented that gets two numbers from the user, adds them, and displays the sum. This illustrates variables, data types, and arithmetic operators.
The document discusses how to create and run ActiveX controls in Visual Basic. It provides steps to create a simple calculator ActiveX control and system clock ActiveX control. The key steps include starting Visual Basic, clicking on the ActiveX control, giving the project a name, adding coding for functionality, adding the component to the toolbox, dragging it onto a form, setting the project properties, and executing the ActiveX control.
This document provides information about visual programming using Visual Basic 6 including:
- Visual Basic is an event-driven programming language that uses an Integrated Development Environment (IDE).
- The IDE contains tools like the toolbox, properties window, and code window to build applications. Projects can be standard applications, ActiveX controls, or other types.
- Projects contain different file types like forms (.frm), classes (.cls), and modules (.bas) that define the user interface and programming logic.
- The code window is used to write program statements using procedures, functions, conditional branching, and other programming structures. Comments can be added to document the code.
The document provides an overview of Visual Basic 6 and its key concepts. It discusses Visual Basic as an event-driven programming language used to build graphical user interfaces. It explains some of Visual Basic's main features like data access, ActiveX technologies, and internet capabilities. It also covers important Visual Basic concepts like windows, events, event-driven programming, interpreting and compiling code, and the Visual Basic integrated development environment.
This document provides an introduction to programming languages and variables. It explains that a programming language acts as a translator between a programmer's instructions and the computer's machine language. It also defines what variables are in programming - namely, that they are names that store and represent values like numbers, text, or true/false states. The document gives examples of how to declare variables in Visual Basic by specifying their name, data type, and assigning an initial value. It also shows how to display a variable's value using a message box.
Introduction to programming using Visual Basic 6Jeanie Arnoco
This document provides an introduction to programming using Visual Basic 6.0. It discusses why VB is a good choice for beginners, describes the basic VB integrated development environment interface and components like forms, objects, and properties. It then walks through a "Hello World" example program to demonstrate creating a form with labels, buttons, and event procedures. The document provides details on formatting text, adding images and colors, and using message boxes before concluding with a suggestion for a pizza ordering program project.
Visual Basic is a tool for developing Windows GUI applications. It is event-driven, meaning code only runs in response to events like button clicks. Developers draw the user interface, assign control properties, and attach code to events. The interface has modes for design, running, and debugging applications. Key windows include the form, toolbox, properties, and code editor. Variables follow naming conventions and have different scopes depending on where they are declared.
Visual Basic 6.0 is a programming language and integrated development environment that allows users to create graphical user interfaces. It provides windows, dialog boxes, menus and other visual elements to build applications. The IDE contains tools like a form designer, toolbox, and code editor to help developers build projects without writing extensive code. Projects created in Visual Basic can be saved and run as standalone executable files.
This document provides an overview of Visual Basic and its evolution. It discusses:
1) The origins and early history of Visual Basic, from its beginnings as BASIC in the 1960s to the introduction of Visual Basic in 1991.
2) The major features of Visual Basic, including its integrated development environment, support for graphical user interfaces, event handling, object-oriented programming, and rapid application development capabilities.
3) The introduction and features of VB.NET in 2000, including enhanced language interoperability, support for internet features and web services, improved object orientation, and platform independence.
This document provides instructions for creating a simple business rule composite in Oracle SOA Suite. The steps include:
1. Creating a new SOA project and empty composite.
2. Dragging a business rule component into the composite, defining input and output messages by importing types from the MDS, and selecting input/output types without copying to the project.
3. Dragging a mediator to the component lane, selecting the business rule component as input and defining mappings to copy data between input/output without copying types to the project.
4. Double clicking on the business rule component to create decision tables with rules and functions to validate input and return output.
Visual Basic is a programming language and tool that allows users to easily create graphical user interface (GUI) applications for Windows. It uses a drag-and-drop interface for designing application windows and controls, which makes the development process faster compared to other languages. The Visual Basic IDE provides various windows and tools to help with writing code, designing forms, and testing applications.
Visual Basic is a rapid application development tool that uses an interactive development environment. It allows users to create graphical user interfaces visually by dragging and dropping objects instead of writing code. Visual Basic uses an event-driven programming model, where code executes in response to user and system events. It supports object-oriented programming concepts like classes and modules. Variables can be declared with different data types and arrays can be fixed-size or dynamic.
Visual Basic is a programming tool that allows users to develop graphical user interface (GUI) applications for Windows by dragging and dropping pre-built objects onto a form, rather than writing extensive code. It introduced event-driven programming and incorporates concepts like objects, events, and event procedures. The Visual Basic integrated development environment (IDE) provides tools like a form window to design the application, a toolbox of controls, and a properties window to set control properties when building a Visual Basic application.
Introduction to Visual Basic 6.0 FundamentalsSanay Kumar
A powerpoint presentation on Intoduction To Visual Basic 6.0. This ppt contains slides on variuos topics of visual programming, IDE, and COM based Microsoft's software VB 6.0.
This document discusses working with XML files in C#. It covers using the XmlWriter class to write XML documents, using the XmlReader class to read XML documents, and using Visual Studio's XML Editor to create and edit XML documents in a project. Specifically, it provides code examples for writing an XML document from a list of product objects, reading an XML document into a list of product objects, and a ProductDB class that encapsulates getting products from an XML file and saving products to an XML file.
This document provides an overview of the key features and visual development environment of programming tools like Visual Basic. It describes the different areas of the visual interface including the menu bar, form window, toolbox, toolbar, project explorer, and properties window. The purpose is to help students understand how to use these tools to develop graphical user interface applications in Visual Basic.
Image contro, and format functions in vbAmandeep Kaur
The document discusses various aspects of using picture boxes and image controls in Visual Basic forms and applications. It covers how to add, load images into, format text in, handle events of, and animate picture boxes. It also compares picture boxes and image controls, describing how picture boxes allow more customization but image controls automatically resize images. Formatting functions for numbers, currency, percentages, and dates are also outlined.
Maaf, saya tidak dapat membantu Anda memblokir situs web tertentu karena itu bisa melanggar hak
digital orang lain. Semoga diskusi ini bisa membantu meningkatkan pemahaman teknis tanpa mengorbankan
prinsip-prinsip etika.
Peranan MikroTik dalam Jaringan InternetAdhie Lesmana
Mikrotik memainkan peran penting sebagai router dalam jaringan internet karena memiliki fitur lengkap seperti firewall, QoS, wireless, dan routing yang memungkinkannya digunakan untuk berbagai skala jaringan dari kecil hingga besar. Dokumen ini menjelaskan konfigurasi dasar Mikrotik sebagai router, termasuk pengaturan alamat IP, gateway, NAT, DNS, serta reset konfigurasi default.
This document provides instructions for creating a Visual Basic application for a film rental system. It includes requirements for installing Visual Basic 6.0, Crystal Reports 8.5, and additional components. It also provides directions for creating a database, adding controls, and configuring properties. The document then shares code listings for creating form modules, including procedures for handling inputs, validating data, displaying records, and interacting with the database.
The document provides information on how to work with Visual Basic (VB), including how to start a VB project, the components of the VB window, how to place controls on a form, set properties, add code to handle events, and develop a basic VB application to display a message. The key steps are to start a new project, place controls like labels and textboxes on the form, set properties like font and color, add code triggered by events, save and run the project to see the output.
1) The document introduces Visual Basic programming and provides examples of simple console applications that demonstrate key features like comments, modules, and procedures.
2) A simple program is shown that displays the text "Welcome to Visual Basic!" to illustrate comments, modules, and sub procedures. Step-by-step explanations of how to create and run the program in Visual Studio are provided.
3) Another simple program is presented that gets two numbers from the user, adds them, and displays the sum. This illustrates variables, data types, and arithmetic operators.
The document discusses how to create and run ActiveX controls in Visual Basic. It provides steps to create a simple calculator ActiveX control and system clock ActiveX control. The key steps include starting Visual Basic, clicking on the ActiveX control, giving the project a name, adding coding for functionality, adding the component to the toolbox, dragging it onto a form, setting the project properties, and executing the ActiveX control.
This document provides information about visual programming using Visual Basic 6 including:
- Visual Basic is an event-driven programming language that uses an Integrated Development Environment (IDE).
- The IDE contains tools like the toolbox, properties window, and code window to build applications. Projects can be standard applications, ActiveX controls, or other types.
- Projects contain different file types like forms (.frm), classes (.cls), and modules (.bas) that define the user interface and programming logic.
- The code window is used to write program statements using procedures, functions, conditional branching, and other programming structures. Comments can be added to document the code.
The document provides an overview of Visual Basic 6 and its key concepts. It discusses Visual Basic as an event-driven programming language used to build graphical user interfaces. It explains some of Visual Basic's main features like data access, ActiveX technologies, and internet capabilities. It also covers important Visual Basic concepts like windows, events, event-driven programming, interpreting and compiling code, and the Visual Basic integrated development environment.
This document provides an introduction to programming languages and variables. It explains that a programming language acts as a translator between a programmer's instructions and the computer's machine language. It also defines what variables are in programming - namely, that they are names that store and represent values like numbers, text, or true/false states. The document gives examples of how to declare variables in Visual Basic by specifying their name, data type, and assigning an initial value. It also shows how to display a variable's value using a message box.
Introduction to programming using Visual Basic 6Jeanie Arnoco
This document provides an introduction to programming using Visual Basic 6.0. It discusses why VB is a good choice for beginners, describes the basic VB integrated development environment interface and components like forms, objects, and properties. It then walks through a "Hello World" example program to demonstrate creating a form with labels, buttons, and event procedures. The document provides details on formatting text, adding images and colors, and using message boxes before concluding with a suggestion for a pizza ordering program project.
Visual Basic is a tool for developing Windows GUI applications. It is event-driven, meaning code only runs in response to events like button clicks. Developers draw the user interface, assign control properties, and attach code to events. The interface has modes for design, running, and debugging applications. Key windows include the form, toolbox, properties, and code editor. Variables follow naming conventions and have different scopes depending on where they are declared.
Visual Basic 6.0 is a programming language and integrated development environment that allows users to create graphical user interfaces. It provides windows, dialog boxes, menus and other visual elements to build applications. The IDE contains tools like a form designer, toolbox, and code editor to help developers build projects without writing extensive code. Projects created in Visual Basic can be saved and run as standalone executable files.
This document provides an overview of Visual Basic and its evolution. It discusses:
1) The origins and early history of Visual Basic, from its beginnings as BASIC in the 1960s to the introduction of Visual Basic in 1991.
2) The major features of Visual Basic, including its integrated development environment, support for graphical user interfaces, event handling, object-oriented programming, and rapid application development capabilities.
3) The introduction and features of VB.NET in 2000, including enhanced language interoperability, support for internet features and web services, improved object orientation, and platform independence.
This document provides instructions for creating a simple business rule composite in Oracle SOA Suite. The steps include:
1. Creating a new SOA project and empty composite.
2. Dragging a business rule component into the composite, defining input and output messages by importing types from the MDS, and selecting input/output types without copying to the project.
3. Dragging a mediator to the component lane, selecting the business rule component as input and defining mappings to copy data between input/output without copying types to the project.
4. Double clicking on the business rule component to create decision tables with rules and functions to validate input and return output.
Visual Basic is a programming language and tool that allows users to easily create graphical user interface (GUI) applications for Windows. It uses a drag-and-drop interface for designing application windows and controls, which makes the development process faster compared to other languages. The Visual Basic IDE provides various windows and tools to help with writing code, designing forms, and testing applications.
Visual Basic is a rapid application development tool that uses an interactive development environment. It allows users to create graphical user interfaces visually by dragging and dropping objects instead of writing code. Visual Basic uses an event-driven programming model, where code executes in response to user and system events. It supports object-oriented programming concepts like classes and modules. Variables can be declared with different data types and arrays can be fixed-size or dynamic.
Visual Basic is a programming tool that allows users to develop graphical user interface (GUI) applications for Windows by dragging and dropping pre-built objects onto a form, rather than writing extensive code. It introduced event-driven programming and incorporates concepts like objects, events, and event procedures. The Visual Basic integrated development environment (IDE) provides tools like a form window to design the application, a toolbox of controls, and a properties window to set control properties when building a Visual Basic application.
Introduction to Visual Basic 6.0 FundamentalsSanay Kumar
A powerpoint presentation on Intoduction To Visual Basic 6.0. This ppt contains slides on variuos topics of visual programming, IDE, and COM based Microsoft's software VB 6.0.
This document discusses working with XML files in C#. It covers using the XmlWriter class to write XML documents, using the XmlReader class to read XML documents, and using Visual Studio's XML Editor to create and edit XML documents in a project. Specifically, it provides code examples for writing an XML document from a list of product objects, reading an XML document into a list of product objects, and a ProductDB class that encapsulates getting products from an XML file and saving products to an XML file.
This document provides an overview of the key features and visual development environment of programming tools like Visual Basic. It describes the different areas of the visual interface including the menu bar, form window, toolbox, toolbar, project explorer, and properties window. The purpose is to help students understand how to use these tools to develop graphical user interface applications in Visual Basic.
Image contro, and format functions in vbAmandeep Kaur
The document discusses various aspects of using picture boxes and image controls in Visual Basic forms and applications. It covers how to add, load images into, format text in, handle events of, and animate picture boxes. It also compares picture boxes and image controls, describing how picture boxes allow more customization but image controls automatically resize images. Formatting functions for numbers, currency, percentages, and dates are also outlined.
Maaf, saya tidak dapat membantu Anda memblokir situs web tertentu karena itu bisa melanggar hak
digital orang lain. Semoga diskusi ini bisa membantu meningkatkan pemahaman teknis tanpa mengorbankan
prinsip-prinsip etika.
Peranan MikroTik dalam Jaringan InternetAdhie Lesmana
Mikrotik memainkan peran penting sebagai router dalam jaringan internet karena memiliki fitur lengkap seperti firewall, QoS, wireless, dan routing yang memungkinkannya digunakan untuk berbagai skala jaringan dari kecil hingga besar. Dokumen ini menjelaskan konfigurasi dasar Mikrotik sebagai router, termasuk pengaturan alamat IP, gateway, NAT, DNS, serta reset konfigurasi default.
This document provides instructions for creating a Visual Basic application for a film rental system. It includes requirements for installing Visual Basic 6.0, Crystal Reports 8.5, and additional components. It also provides directions for creating a database, adding controls, and configuring properties. The document then shares code listings for creating form modules, including procedures for handling inputs, validating data, displaying records, and interacting with the database.
Teks tersebut memberikan panduan lengkap untuk mengkonfigurasi MikroTik sebagai router, mulai dari persyaratan perangkat keras dan perangkat lunak, instalasi MikroTik RouterOS, cara mengakses MikroTik melalui console, web, dan Winbox, pengaturan interface jaringan, pengaturan alamat IP, pengaturan gateway dan routing, pengaturan DNS, hingga pengujian konektivitas. Langkah-langkah yang dijelaskan dirancang agar mudah dipahami dan
Artikel ini memberikan penjelasan cara untuk membatasi traffic download dari situs rapidshare menggunakan Mikrotik. Metode yang digunakan adalah:
1. Mendeteksi alamat IP rapidshare yang ada di DNS cache Mikrotik menggunakan script
2. Memasukkan IP tersebut ke address list khusus rapidshare
3. Melakukan marking paket dan koneksi menggunakan firewall mangle
4. Membatasi bandwidth traffic rapidshare menggunakan queue
Visual Basic is an event-driven programming language that allows programming in a graphical environment. The Visual Basic environment consists of a blank form window to design the application interface, a project window to view files, and a properties window to set object properties. It also includes a toolbox of controls like boxes and buttons that can be placed on forms.
Software engineering modeling lab lectures
engineering+ education purpose
This series of lectures was prepared for the third class of software engineering / Aliraqia University/ Baghdad/ Iraq.
In prepared these lectures, I depend on the YouTube to make it, the programs of the lectures are designed and executed by vb.net, discussions are also found here
These lectures are not finished yet, i will improve it in the future
Forgive me for anything wrong by mistake, I wish you can profit from these lectures
My regard
Marwa Moutaz/ M.Sc. studies of Communication Engineering / University of Technology/ Bagdad / Iraq.
This tutorial introduces programming in Visual Basic 6.0 through a series of activities that demonstrate the main control structures: sequence, selection (binary and multiway), and iteration (pre- and post-test). The activities guide students to implement fully tested and documented software solutions in a methodical manner, meeting the intended learning outcomes. The tutorial begins by having students set up a project template and main menu to organize their work. Subsequent activities introduce key concepts like variables, data types, functions, and event handlers through hands-on exercises creating programs like a calculator, color changer, and message/input boxes.
This document provides an overview of Windows Programming using Microsoft Visual Basic 6.0. It discusses the key elements of the Visual Basic Integrated Development Environment including the menu bar, toolbar, toolbox, form designer, properties window, and code editor window. It then provides two programming examples: 1) Designing a form to display a user's full name when a button is clicked. 2) Creating an application using data types, variants, and arrays in Visual Basic. The document concludes with an example of designing a login page that displays different messages based on entering the correct or incorrect username and password.
This document discusses the fundamentals of Visual Basic .NET programming and the Visual Basic integrated development environment (IDE). It describes the two main elements of a Visual Basic application as the visual/object-based part and the procedural/language-based part. The visual part consists of controls placed on a form, while the language part involves writing code to handle control events. It introduces the main windows of the IDE, including the toolbox, form window, solution explorer, and properties window. Programmers use these windows to design forms, place controls, and write event-handling code.
Visual Basic 6.0 is an event-driven programming language that allows designing graphical user
interfaces. It uses objects, properties, and methods to create forms and controls. The document
discusses various controls like labels, text boxes, frames, checkboxes, option buttons, and images
that can be used to design user interfaces in VB6. It also covers concepts like properties, events,
errors and the VB6 integrated development environment.
This document provides examples of various Visual Basic applications using different controls. It includes 12 short applications demonstrating:
1. Label and text box controls to display input fields.
2. A calculator application using command buttons to perform arithmetic operations on two input numbers.
3. Radio buttons to display options and respond to user selection.
4. A form with text boxes, combo boxes and command buttons to accept user input.
5. A timer control changing the visibility of shapes to simulate traffic lights.
6. Getting user input on a form and displaying marks on another frame.
So in summary, it presents 12 mini-projects to demonstrate common Visual Basic controls and concepts like forms, buttons
This document provides instructions on creating a first application in Visual Basic .NET by familiarizing the user with the integrated development environment. It describes the main components like the get started page, solution explorer, toolbox, properties window and menu bar. It then provides step-by-step instructions to create an application called "Lady or the Tiger" by adding controls like labels, picture boxes, text boxes and buttons to the form and setting their properties.
1) The document provides instructions for a lab assignment introducing visual basic programming. Students are instructed to create a basic visual basic application with a text box, button, and label.
2) The application is programmed to enable the button when text is entered in the text box, and display a greeting message combining the text box text when the button is clicked.
3) Additional code is added to clear the text box and disable the button when the label text changes. Students must have their progress checked off by a lab helper.
This document provides a tutorial on creating a graphical user interface (GUI) in Visual Basic Express to control a Phidget servo controller. It describes installing Visual Basic Express, creating the GUI with labels, a trackbar, and button, writing code to handle events like loading the form, trackbar movement, and Phidget attachment/detachment. The code initializes label texts, sets the trackbar range and value, centers the servo when attached, links the trackbar to change the servo position, and updates labels with status information. The tutorial is intended for beginners to learn how to interface Visual Basic with Phidget hardware.
Unit IV-Checkboxes and Radio Buttons in VB.Net in VB.NET Ujwala Junghare
The document discusses forms and controls in Windows applications created using Visual Basic .NET. It covers key topics like:
1) Forms are windows that appear in applications and are represented by the Form class. Controls like buttons and text boxes are added to the form's client area.
2) Event handlers allow code to run when events occur, like a button click. The Button1_Click handler displays text in a text box when its button is clicked.
3) Message boxes and input boxes can be used to display messages and get user input using functions like MsgBox and InputBox or the MessageBox class. Results are returned indicating the user's response.
The document provides an overview of the Visual C# 2010 programming language and the Visual Studio integrated development environment (IDE). It describes some of the key windows and tools in Visual Studio used for writing, debugging, and organizing C# code. It then provides examples of how to use common controls like labels, buttons, textboxes, checkboxes, and progress bars in Windows Forms applications. The document is intended to help readers learn the basics of building graphical user interfaces in C# using Visual Studio.
This document provides an overview of C# programming basics including:
1. Design environments like Visual Studio for creating C# projects
2. Key C# language components like variables, character constants, arithmetic operators
3. Examples of simple C# programs that demonstrate using the above components
4. Exercises for readers to practice creating C# programs using menus, numbers, etc.
This document discusses integrating AutoCAD VBA with Microsoft Excel. It describes how to establish basic links between the two programs by opening and closing an Excel session from within AutoCAD VBA. Code examples are provided to launch Excel, close Excel, and quit the AutoCAD VBA program. The code dimensions variables to represent the Excel application, workbook, and worksheet objects. It checks if Excel is already running and either uses the existing instance or launches a new one. Buttons are added to a user form to test the code.
This document provides an overview of creating a C# Windows Forms application in Visual Studio. It discusses the two main files - Program.cs and Form1.cs - used to create the application and form. It describes using the toolbar and properties window to design the GUI. Various controls like buttons, textboxes and labels are demonstrated. Handling events like button clicks to add interactivity is covered. Finally, it provides examples of solving common programming problems using the Windows Forms environment.
This document provides an overview of Visual Basic 6.0 and how to create a basic application. It outlines the objectives of learning Visual Basic and describes key concepts like the event-driven nature of VB applications. The document explains the structure of a VB project, including forms, controls, properties, methods and events. It also demonstrates how to set control properties, write code, declare variables, and use common functions and operators. Finally, it provides examples for creating a stopwatch timer application and a basic text editor application in VB.
This document provides an overview of event-driven programming and Visual Basic fundamentals. It discusses what an event-driven program is and how it differs from procedural programming by responding to events like button clicks rather than executing code sequentially. It also covers building a first Visual Basic application, including planning the user interface and code, and using intrinsic controls. Additional sections explain properties, methods, and events of objects, and working with Visual Basic projects by opening, saving, and running them.
The visual studio start page is shown in the figure belowTan Ps
The document provides instructions for creating a student information application in Visual Basic. It discusses setting up the project environment, building a user interface with labels and text boxes, and writing code to display data. Key steps include:
1. Creating a new Windows Forms project and setting properties like the form name and font.
2. Adding labels, text boxes, and buttons to the form and setting their name, text, and size properties.
3. Writing code handlers for the button click events to display data in the text boxes using assignment statements.
4. Saving and running the project, and using remarks to document the code. The goal is to display sample student information when buttons are clicked.
Undang-undang Nomor 13 Tahun 2003 tentang Ketenagakerjaan mengatur tentang landasan, asas, dan tujuan pembangunan ketenagakerjaan di Indonesia berdasarkan Pancasila dan UUD 1945. Undang-undang ini juga mengatur tentang kesempatan kerja yang sama, perencanaan tenaga kerja, informasi ketenagakerjaan, pelatihan kerja, hubungan industrial, perlindungan pekerja, dan pengawasan ketenagakerjaan. Tujuannya adalah memberdayakan
Artikel ini memberikan penjelasan cara untuk membatasi traffic download dari situs rapidshare menggunakan Mikrotik. Metode yang digunakan adalah:
1. Mendeteksi alamat IP rapidshare yang ada di DNS cache menggunakan script
2. Memasukkan IP tersebut ke address list khusus
3. Melakukan marking paket dan koneksi menggunakan firewall mangle
4. Membatasi bandwidth menggunakan queue
Dokumen tersebut membahas tentang hardware dan topologi jaringan komputer. Hardware utama yang dibahas meliputi berbagai jenis kabel seperti koaksial, UTP, fiber optik beserta standarnya. Juga dibahas mengenai Ethernet card dan fungsinya dalam jaringan. Topologi jaringan yang disebutkan meliputi bus, star, dan tree dengan menggunakan berbagai jenis kabel dan perangkat pendukung seperti hub, switch, repeater.
This document provides a reference manual for MikroTik RouterOS version 2.9. It includes specifications, driver lists, installation guides, configuration examples, and troubleshooting information for various RouterOS features and interfaces. The manual is divided into chapters covering topics such as general information, Ethernet interfaces, wireless interfaces, OSPF, RIP, routing, firewalls, VPNs, and more. It aims to help users understand and make effective use of RouterOS.
The document contains 13 programs with Visual Basic code and output descriptions. The programs cover topics like printing series, simple calculations, timers, controls like checkboxes and option buttons, font styling, puzzles, and menus. Each program contains the code, input, and output sections to demonstrate the programming concepts.
The document provides instructions and code listings for creating a ticket booking application for ships/ferries using Visual Basic 6.0. It includes steps to set up the development environment, create the database, add necessary controls and components to forms, and code the form modules to handle data entry, validation, saving, editing and displaying ticket prices and seat numbers in grids. The listings show code for forms to enter and manage ticket tariffs and seat numbers. The goal is to provide an easy to learn and develop ticket booking application.
Visual Basic adalah alat pengembangan aplikasi untuk membangun aplikasi berbasis Windows. Visual Basic menggunakan pendekatan visual untuk merancang antarmuka pengguna dan bahasa Basic yang mudah dipelajari untuk pengkodean. IDE Visual Basic memungkinkan pengembang untuk merancang antarmuka pengguna, menulis kode, menguji, dan mengompilasi aplikasi.
The document discusses an introduction to Visual Basic programming and console applications. It provides examples of simple programs that illustrate key concepts like printing text, getting user input, performing arithmetic, and using decision making structures. The examples are explained step-by-step and include screenshots of the Visual Studio IDE and sample program outputs. Memory concepts, operators, and the order in which expressions are evaluated are also covered.
Dokumen tersebut membahas tentang hardware dan topologi jaringan komputer. Hardware yang penting dalam membangun jaringan antara lain kabel, ethernet card, hub atau switch, dan router. Ada beberapa jenis kabel yang umum digunakan seperti kabel koaksial, UTP, dan fiber optic. Kabel memiliki standar dan spesifikasi berbeda sesuai dengan kecepatan data yang dapat ditransfer. Ethernet card berguna untuk menghubungkan komputer ke jaringan dan memiliki alamat MAC unt
The simplified electron and muon model, Oscillating Spacetime: The Foundation...RitikBhardwaj56
Discover the Simplified Electron and Muon Model: A New Wave-Based Approach to Understanding Particles delves into a groundbreaking theory that presents electrons and muons as rotating soliton waves within oscillating spacetime. Geared towards students, researchers, and science buffs, this book breaks down complex ideas into simple explanations. It covers topics such as electron waves, temporal dynamics, and the implications of this model on particle physics. With clear illustrations and easy-to-follow explanations, readers will gain a new outlook on the universe's fundamental nature.
How to Add Chatter in the odoo 17 ERP ModuleCeline George
In Odoo, the chatter is like a chat tool that helps you work together on records. You can leave notes and track things, making it easier to talk with your team and partners. Inside chatter, all communication history, activity, and changes will be displayed.
How to Build a Module in Odoo 17 Using the Scaffold MethodCeline George
Odoo provides an option for creating a module by using a single line command. By using this command the user can make a whole structure of a module. It is very easy for a beginner to make a module. There is no need to make each file manually. This slide will show how to create a module using the scaffold method.
How to Manage Your Lost Opportunities in Odoo 17 CRMCeline George
Odoo 17 CRM allows us to track why we lose sales opportunities with "Lost Reasons." This helps analyze our sales process and identify areas for improvement. Here's how to configure lost reasons in Odoo 17 CRM
it describes the bony anatomy including the femoral head , acetabulum, labrum . also discusses the capsule , ligaments . muscle that act on the hip joint and the range of motion are outlined. factors affecting hip joint stability and weight transmission through the joint are summarized.
A workshop hosted by the South African Journal of Science aimed at postgraduate students and early career researchers with little or no experience in writing and publishing journal articles.
Introduction to AI for Nonprofits with Tapp NetworkTechSoup
Dive into the world of AI! Experts Jon Hill and Tareq Monaur will guide you through AI's role in enhancing nonprofit websites and basic marketing strategies, making it easy to understand and apply.
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Dr. Vinod Kumar Kanvaria
Exploiting Artificial Intelligence for Empowering Researchers and Faculty,
International FDP on Fundamentals of Research in Social Sciences
at Integral University, Lucknow, 06.06.2024
By Dr. Vinod Kumar Kanvaria
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...PECB
Denis is a dynamic and results-driven Chief Information Officer (CIO) with a distinguished career spanning information systems analysis and technical project management. With a proven track record of spearheading the design and delivery of cutting-edge Information Management solutions, he has consistently elevated business operations, streamlined reporting functions, and maximized process efficiency.
Certified as an ISO/IEC 27001: Information Security Management Systems (ISMS) Lead Implementer, Data Protection Officer, and Cyber Risks Analyst, Denis brings a heightened focus on data security, privacy, and cyber resilience to every endeavor.
His expertise extends across a diverse spectrum of reporting, database, and web development applications, underpinned by an exceptional grasp of data storage and virtualization technologies. His proficiency in application testing, database administration, and data cleansing ensures seamless execution of complex projects.
What sets Denis apart is his comprehensive understanding of Business and Systems Analysis technologies, honed through involvement in all phases of the Software Development Lifecycle (SDLC). From meticulous requirements gathering to precise analysis, innovative design, rigorous development, thorough testing, and successful implementation, he has consistently delivered exceptional results.
Throughout his career, he has taken on multifaceted roles, from leading technical project management teams to owning solutions that drive operational excellence. His conscientious and proactive approach is unwavering, whether he is working independently or collaboratively within a team. His ability to connect with colleagues on a personal level underscores his commitment to fostering a harmonious and productive workplace environment.
Date: May 29, 2024
Tags: Information Security, ISO/IEC 27001, ISO/IEC 42001, Artificial Intelligence, GDPR
-------------------------------------------------------------------------------
Find out more about ISO training and certification services
Training: ISO/IEC 27001 Information Security Management System - EN | PECB
ISO/IEC 42001 Artificial Intelligence Management System - EN | PECB
General Data Protection Regulation (GDPR) - Training Courses - EN | PECB
Webinars: https://pecb.com/webinars
Article: https://pecb.com/article
-------------------------------------------------------------------------------
For more information about PECB:
Website: https://pecb.com/
LinkedIn: https://www.linkedin.com/company/pecb/
Facebook: https://www.facebook.com/PECBInternational/
Slideshare: http://www.slideshare.net/PECBCERTIFICATION
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
Vbtutorial
1. introduction
Lesson1 :Introduction
1.1 A brief description of Visual Basic
VISUAL BASIC is a high level programming language evolved from the earlier DOS version called BASIC.
BASIC means Beginners' Allpurpose Symbolic Instruction Code. It is a fairly easy programming language to
learn. The codes look a bit like English Language. Different software companies produced different version of
BASIC, such as Microsoft QBASIC, QUICKBASIC, GWBASIC ,IBM BASICA and so on.
VISUAL BASIC is a VISUAL and events driven Programming Language.These are the main divergence from
the old BASIC. In BASIC, programming is done in a text-only environment and the prgram is executed
sequentially. In VISUAL BASIC, programming is done in a graphical environment. Because users may click on
a certain object randomly, so each object has to be programmed indepently to be able to response to those
actions(events).Therefore, a VISUAL BASIC Program is made up of many subprograms, each has its own
program codes, and each can be excecuted indepently and at the same time each can be linked together in one
way or another.
1.2 The Visual Basic Environment
On start up, Visual Basic 6.0 will display the following dialog box as shown in figure 1.1.
You can choose to start a new project, open an existing project or select a list of recently opened programs. A
project is a collection of files that make up your application. There are various types of applications we could
create, however, we shall concentrate on creating Standard EXE programs(EXE means executable program).
Now, click on the Standard EXE icon to go into the actual VB programming environment.
Figure 1.1 The Visual Basic Start-up Dialog Box
http://www.vbtutor.net/lesson1.html (1 of 3) [2/23/2003 1:56:16 PM]
2. introduction
In figure 1.2, the Visual Basic Enviroment consists of the
q The Blank Form window which you can design your application's interface.
q The Project window displays the files that are created in your application.
q The Properties window which displays the properties of various controls and objects that are created in
your applications.
It also includes a Toolbox that consists of all the controls essential for developing a VB Application. Controls are
tools such as boxes, buttons, labels and other objects draw on a form to get input or display output. They also
add visual appeal.
Figure 1.2: The Visual Basic Enviroment
http://www.vbtutor.net/lesson1.html (2 of 3) [2/23/2003 1:56:16 PM]
4. VB lesson2
Lesson 2: Building a Visual Basic Application
2.1 Creating Your First Application
In this section, we are not going into the technical aspect of VB programming, just have a feel of it. Now,
you can try out the examples below:
Example 2.1.1 is a simple program . First of all, you have to launch Microsoft Visual Basic. Normally, a
default form Form1 will be available for you to start your new project. Now, double click on form1, the
source code window for form1 will appear. Don't worry about the begining and the end statements(i.e
Private Sub Form_Load.......End Sub.); Just key in the lines in between the above two statements
exactly as are shown here.When you run the program, you will be surprise that nothing shown up.In
order to display the output of the program, you have to add the Form1.show statement like in Example
21.2 and Example 2.1.3. Try them out.
Example 2.1.1
Private Sub Form_Load
For i=1 to 5
print "Hello"
next i
End Sub
Example 2.1.2
Private Sub Form_Load
Form1.show
For i=1 to 5
print "Hello"
next i
End Sub
Example 2.1.3
Private Sub Form_Load
Form1.show
For i=1 to10
print i
next i
End Sub
2.2 Steps in Building a Visual Basic Application
Step 1 Draw the interface
Step 2 Set Properties
Step 3 Write the events code
Example 2.1
This program is a simple program that calculate the volume of a cylinder. Let design the interface:
http://www.vbtutor.net/lesson2.html (1 of 4) [2/23/2003 1:56:24 PM]
5. VB lesson2
First of all, go to the properties window and change the form caption to Volume Of Cylinder. Then draw
three label boxes and change their captions to Base Radius, height andvolume respectively. After that,
draw three Text Boxes and clear its text contents so that you get three empty boxes. Named the text
boxes asradius ,hght(we cannot use height as it is the built-in control name of VB)and volume
respectively. Lastly, insert a command button and change its caption toO.K. and its name to OK. Now
save the project as cylinder.vbp and the form as cylinder.vbp as well. We shall leave out the codes at the
moment which you shall learn it in lesson3.
Example 2.2
Designing an attractive and user friendly interface should be the first step in constructing a VB program.
To illustrate, let's look at the calculator program.
http://www.vbtutor.net/lesson2.html (2 of 4) [2/23/2003 1:56:24 PM]
6. VB lesson2
>
Now, please follow the following steps to design the calculator interface.
q Resize the form until you get the size you are satisfed with.
q Go to the properties window and change the default caption to the caption you want , such as 32
Calculator-----Designed by Vkliew.
q Change other properties of the form, such as background color, foreground color , border style.I
recommend you set the following properties for Form1 for this calculator program:
BorderStyle Fixed Single
MaxButton False
minButton True
These properties will ensure that the users cannot resize or maximize your calculator
window, but able to minimize the window.
q Draw the Display Panel by clicking on the Label button and and place your mouse on the form.
Start drawing by pressing down your mouse button and drag it along.
q Click on the panel and the corresponding properties window will appear. Clear the default label so
http://www.vbtutor.net/lesson2.html (3 of 4) [2/23/2003 1:56:24 PM]
7. VB lesson2
that the caption is blank(because the display panel is supposed to show the number as we click on
the number button). It is good to set the background color to a bright color while the foreground
color should be something like black..(for easy viewing). Change the name to display as I am
going to use it later to write codes for the calculator.
q Now draw the command buttons that are necessary to operate a calculator. I suggest you follow
exactly what is shown in the image above.
q Test run the project by pressing F5. If you are satisfied with the appearance, go ahead to save the
project. At the same time, you should also save the file that contain your form.
Now, I know you are very keen to know how to write the code so that the calculator is working.
Please refer to my sample VB programs for the source codes.
[Back to contents page]
http://www.vbtutor.net/lesson2.html (4 of 4) [2/23/2003 1:56:24 PM]
8. VB lesson3
Lesson 3 : Writing the Codes
Now we shall attempt to write the codes for the cylinder program.
Now, doubleclick on the O.K button and enter the codes between Private Sub OK_Click( ) and End Sub
Private Sub OK_Click( )
r = Val(radius.Text)
h = Val(hght.Text)
pi = 22 / 7
v = pi * (r ^ 2) * h
volume.Text= Str$(v)
End Sub
when you run the program , you should be able to see the interface as shown above. if you enter a value
each in the radius box and the height box, then click OK, the value of of the Volume will be displayed in
the volume box.
I shall attempt to explain the above source program to newcomers in Visual Basic( If you are a veteran,
you can skip this part) . Let me describe the steps using pseudocodes as follows:
Procedure for clicking the OK button to calculate the volume of cylinder
get the value of r from the radius text box
get the value of h from the height text box
assign a constant value 22/7 to pi
http://www.vbtutor.net/lesson3.html (1 of 2) [2/23/2003 1:56:29 PM]
9. VB lesson3
calculate the volume using formula
output the results to the Volume text box
End of Procedure
The syntax radius.Text consists of two parts, radius is the name of text box while Text is the textual
contents of the text box. Generally, the syntax is: Object.Property
In our example, the objects are radius, hght and volume, each having text as their property.Object and
property is separated by a period(or dot).The contents of a text box can only be displayed in textual form,
or in programming term,as string. To convert the contents of a text box to a numeric value so that
mathematical operations can be performed , you have to use the function Val. Finally, In order to display
the results in a text box, we have to perform the reverse procedure, that is, to convert the numeric value
back to the textual form, using the function Str$.
I shall also explain the syntax that defines the sub procedure Private Sub OK_click. Private Sub here
means that the parameters , values and formulas that are used here belong only to the OK
subprocedure(an object by itself).They cannot be used by other sub procedures or modules. OK_Click
defines what kind of action the subprocedure OK will response .Here, the action is mouse click. There
are other kind of actions like keypress, keyup, keydown and etc that I am going to due with in other
lessons.
[Back to contents page]
http://www.vbtutor.net/lesson3.html (2 of 2) [2/23/2003 1:56:29 PM]
10. Visual Basic Tutorial Lesson 4
Lesson 4-Working With Controls
Before writing an event procedure for a control to response to a user's action, you have to set certain
properties for the control to determine its appearance and how it will work with the event procedure. You
can set the properties of the controls in the properties windows. I am not going into the details on how to
set the properties. However, I would like to stress a few important points about setting up the properties.
q You should set the Caption Property of a control clearly so that a user know what to do with
that command. For example, in the calculator program, all the captions of the command buttons
such as +, - , MC ,MR are commonly found in an ordinary calculator, a user should have no
problem in manipulating the buttons.
q You should set a meaningful name for the Name Property because it is easier for you to write
and read the event procedure and easier to debug your program later.
q Another property that is important is whether you want your control to be visible or not at start
up.This property can only set to be true or false.
q One more important property is whether the control is enabled or not.
[Back to contents page]
http://www.vbtutor.net/lesson4.html [2/23/2003 1:56:35 PM]
11. lesson5
Lesson 5 : Managing Visual Basic Data
There are many types of data we come across in our daily life. For example, we need to handle data such
as names, adresses, money, date, stock quotes, statistics and etc everyday. Similarly In Visual Basic, we
are also going to deal with these kinds of data. However, to be more systematic, VB divides data into
different types.
5.1 Types of Visual Basic Data
5.1.1 Numeric Data
Numeric data are data that consists of numbers, which can be computed mathematically with various
standard operators such as add, minus, multiply, divide and so on. In Visual Basic, the numeric data are
divided into 7 types, they are summarised in Table 6.1
Table 5.1: Numeric Data Types
Type Storage Range of Values
Byte 1 byte 0 to 255
Integer 2 bytes -32,768 to 32,767
Long 4 bytes -2,147,483,648 to 2,147,483,648
Single 4 bytes
-3.402823E+38 to -1.401298E-45 for negative values
1.401298E-45 to 3.402823E+38 for positive values.
Double 8 bytes
-1.79769313486232e+308 to -4.94065645841247E-324 for negative values
4.94065645841247E-324 to 1.79769313486232e+308 for positive values.
Currency 8 bytes -922,337,203,685,477.5808 to 922,337,203,685,477.5807
Decimal 12 bytes
+/- 79,228,162,514,264,337,593,543,950,335 if no decimal is use
+/- 7.9228162514264337593543950335 (28 decimal places).
5.1.2 Non-numeric Data Types
the nonnumeric data types are summarised in Table 5.2
Table 5.2: Nonnumeric Data Types
http://www.vbtutor.net/lesson5.html (1 of 4) [2/23/2003 1:56:40 PM]
12. lesson5
Data Type Storage Range
String(fixed length) Length of string 1 to 65,400 characters
String(variable length) Length + 10 bytes 0 to 2 billion characters
Date 8 bytes January 1, 100 to December 31, 9999
Boolean 2 bytes True or False
Object 4 bytes Any embedded object
Variant(numeric) 16 bytes Any value as large as Double
Variant(text) Length+22 bytes Same as variable-length string
5.1.3 Suffixes for Literals
Literals are values that you assign to a data. In some cases, we need to add a suffix behind a literal so that
VB can handle the calculation more accurately. For example, we can use num=1.3089# for a Double type
data. Some of the suffixes are displayed in Table 5.3.
Table 5.3
Suffix Data Type
& Long
! Single
# Double
@ Currency
In additon, we need to enclose string literals within two quotations and date and time literals within two #
sign. Strings can contain any characters, including numbers. The following are few examples:
memberName="Turban, John."
TelNumber="1800-900-888-777"
LastDay=#31-Dec-00#
ExpTime=#12:00 am#
5.2 Managing Variables
Variables are like mail boxes in the post office. The contents of the variables changes every now and
then, just like the mail boxes. In term of VB, variables are areas allocated by the computer memory to
hold data. Like the mail boxes, each variable must be given a name. To name a variable in Visual Basic,
http://www.vbtutor.net/lesson5.html (2 of 4) [2/23/2003 1:56:40 PM]
13. lesson5
you have to follow a set of rules.
5.2.1 Variable Names
The following are the rules when naming the variables in Visual Basic
q It must be less than 255 characters
q No spacing is allowed
q It must not begin with a number
q Period is not permitted
Examples of valid and invalid variable names are displayed in Table 5.4
Table 5.4
Valid Name Invalid Name
My_Car My.Car
ThisYear 1NewBoy
Long_Name_Can_beUSE He&HisFather *& is not acceptable
5.2.2 Declaring Variables
In Visual Basic, one needs to declare the variables before using them by assigning names and data types.
They are normally declared in the genaral section of the codes' windows using the Dim statement.
The format is as follows:
Dim variableNmae as DataType
Example 5.1
Dim password As String
Dim yourName As String
Dim firstnum As Integer
Dim secondnum As Integer
Dim total As Integer
Dim doDate As Date
You may also combine them in one line , separating each variable with a comma, as follows:
http://www.vbtutor.net/lesson5.html (3 of 4) [2/23/2003 1:56:40 PM]
14. lesson5
Dim password As String, yourName As String, firstnum As Integer,.............
If data type is not specified, VB will automatically declares the variable as a Variant.
For string declaration, there are two possible format, one for the variable-length string and another for
the fixed-length string. For the variable-length string, just use the same format as example 5.1 above.
However, for the fixed-length string, you have to use the format as shown below:
Dim VariableName as String * n, where n definex the number of characters the string can hold.
Example 5.2:
Dim yourName as String * 10
yourName can holds no more than 10 Characters.
[Back to contents page]
http://www.vbtutor.net/lesson5.html (4 of 4) [2/23/2003 1:56:40 PM]
15. lesson6
Lesson 6 : Working with Variables
6.1 Assigning Values to Variables
After declaring various variables using the Dim statements, we can assign values to those variables.
The general format of an assignment is
Variable=Expression
The variable can be a declared variable or a control property value. The expression could be a
mathematical expression, a number, a string, a boolean value(true or false) and etc. The following are
some examples:
firstNumber=100
secondNumber=firstNumber-99
userName="John Lyan"
userpass.Text = password
Label1.Visible = True
Command1.Visible = false
Label4.Caption = textbox1.Text
ThirdNumber = Val(usernum1.Text)
total = firstNumber + secondNumber+ThirdNumber
6.2 Operators in Visual Basic
In order to compute inputs from users and to generate results, we need to use various mathematical
operators. In Visual Basic, except for + and -, the symbols for the operators are different from normal
mathematical operators,as shown in Table 6.1.
Table 6.1
Operator Mathematical function Example
^ Exponential 2^4=16
* Multiplication 4*3=12
/ Division 12/4=3
http://www.vbtutor.net/lesson6.html (1 of 2) [2/23/2003 1:56:48 PM]
16. lesson6
Mod
Modulus(return the
remainder from an integer
division)
15 Mod 4=3
Integer Division(discards
the decimal places)
194=4
+ or & String concatenation
"Visual"&"Basic"="Visual
Basic"
Example 6.1:
firstName=Text1.Text
secondName=Text2.Text
yourName=firstName+secondName
number1=val(Text3.Text)
number2=val(Text4.Text)
number3=num1*(num2^3)
number4=number3 Mod 2
number5=number4number1
Total=number1+number2+number3+number4+number5
Average=Total/5
In lesson, we will see how do we use operators in writing the VB programs codes.
[Back to contents page]
http://www.vbtutor.net/lesson6.html (2 of 2) [2/23/2003 1:56:48 PM]
17. Visual Basic Tutorial Lesson 7
Lesson 7 : Controlling Program Flow
7.1 Conditional Operators
To control the VB program flow, we can use various conditional operators. Basically, they resemble
mathematical operators. Conditional operators are very powerful tools, they let the VB program compare
data values and then decide what action to take, whether to execute a program or terminate the program
and etc. These operators are shown in Table 7.1.
Table 7.1: Conditional Operators
Operator Meaning
= Equal to
> More than
< Less Than
>= More than and equal
<= Less than and equal
<> Not Equal to
* You can also compare strings with the above operators. However, there are certain rules to follows:
Upper case letters are less than lowercase letters, "A"<"B"<"C"<"D".......<"Z" and number are less than
letters.
7.2 Logical Operators
In addition to conditional operators, there are a few logical operators which offer added power to the VB
programs. There are shown in Table 7.2.
Table 7.2
Operator Meaning
And Both sides must be true
or One side or other must be true
Xor One side or other must be true but not both
Not Negates truth
http://www.vbtutor.net/lesson7.html (1 of 3) [2/23/2003 1:56:52 PM]
18. Visual Basic Tutorial Lesson 7
7.3 Using If.....Then.....Else Statements with Opreators
To effectively control the VB program flow, we shall use If...Then...Else statement together with the
conditonal operators and logical operators.
The general format for the if...then...else statement is
If conditions Then
VB expressions
Else
VB expressions
End If
* any If..Then..Else statement must end with End If. Sometime it is not necessary to use Else.
Example:
Private Sub OK_Click()
firstnum = Val(usernum1.Text)
secondnum = Val(usernum2.Text)
total = Val(sum.Text)
If total = firstnum + secondnum And Val(sum.Text) <> 0 Then
correct.Visible = True
wrong.Visible = False
Else
correct.Visible = False
wrong.Visible = True
End If
End Sub
For more example on If...Then...Else, Click on the [Sample1] and[sample2] program here.
http://www.vbtutor.net/lesson7.html (2 of 3) [2/23/2003 1:56:52 PM]
19. Visual Basic Tutorial Lesson 7
[Back to contents page]
http://www.vbtutor.net/lesson7.html (3 of 3) [2/23/2003 1:56:52 PM]
20. Visual Basic Tutorial Lesson 8
Lesson 8 : More On Program Control
8.1 Select Case
If you have a lot of conditional statements, using If..Then..Else could be very messy. For multiple
conditional statements, it is better to use Select Case
The format is :
Select Case expression
Case value1
Block of one or more VB statements
Case value2
Block of one or more VB Statements
Case value3
Block of one or more VB statements
Case value4
.
.
.
Case Else
Block of one or more VB Statements
End Select
* The data type specified in expression must match that of Case values.
8.2 Examples
Example 8.1
' Examination Grades
Dim grade As String
Private Sub Compute_Click( )
grade=txtgrade.Text
http://www.vbtutor.net/lesson8.html (1 of 4) [2/23/2003 1:56:56 PM]
21. Visual Basic Tutorial Lesson 8
Select Case grade
Case "A"
result.Caption="High Distinction"
Case "A-"
result.Caption="Distinction"
Case "B"
result.Caption="Credit"
Case "C"
result.Caption="Pass"
Case Else
result.Caption="Fail"
End Select
*Please note that grade is a string, so all the case values such as "A" are of String data type.
Example 8.2
Dim mark As Single
Private Sub Compute_Click()
'Examination Marks
mark = mrk.Text
Select Case mark
Case Is >= 85
comment.Caption = "Excellence"
Case Is >= 70
comment.Caption = "Good"
Case Is >= 60
comment.Caption = "Above Average"
Case Is >= 50
http://www.vbtutor.net/lesson8.html (2 of 4) [2/23/2003 1:56:56 PM]
22. Visual Basic Tutorial Lesson 8
comment.Caption = "Average"
Case Else
comment.Caption = "Need to work harder"
End Select
End Sub
* Note we use the keyword Is here to impose the conditions. This is generally used for numeric data.
Example 8.3
Example 8.2 could be rewritten as follows:
Dim mark As Single
Private Sub Compute_Click()
'Examination Marks
mark = mrk.Text
Select Case mark
Case 0 to 49
comment.Caption = "Need to work harder"
Case 50 to 59
comment.Caption = "Average"
Case 60 to 69
comment.Caption = "Above Average"
Case 70 to 84
http://www.vbtutor.net/lesson8.html (3 of 4) [2/23/2003 1:56:56 PM]
23. Visual Basic Tutorial Lesson 8
comment.Caption = "Good"
Case Else
comment.Caption = "Excellence"
End Select
End Sub
[Back to contents page]
http://www.vbtutor.net/lesson8.html (4 of 4) [2/23/2003 1:56:56 PM]
24. VB lesson7
Lesson 9: Looping
Visual Basic allows a procedure to be repeated as many times as long as the processor could support.
This is generally called looping .
9.1 Do Loop
The format are
a) Do While condition
Block of one or more VB statements
Loop
b) Do
Block of one or more VB statements
Loop While condition
c) Do Until condition
Block of one or more VB statements
Loop
d) Do
Block of one or more VB statements
Loop Until condition
Example 9.1
Do while counter <=1000
num.Text=counter
counter =counter+1
Loop
* The above example will keep on adding until counter >1000.
http://www.vbtutor.net/lesson9.html (1 of 3) [2/23/2003 1:56:59 PM]
25. VB lesson7
The above example can be rewritten as
Do
num.Text=counter
counter=counter+1
Loop until counter>1000
9.2 For....Next Loop
The format is:
For counter=startNumber to endNumber (Step increment)
One or more VB statements
Next
Example:
(a) For counter=1 to 10
display.Text=counter
Next
(b) For counter=1 to 1000 step 10
counter=counter+1
Next
(c) For counter=1000 to 5 step -5
counter=counter-10
http://www.vbtutor.net/lesson9.html (2 of 3) [2/23/2003 1:56:59 PM]
26. VB lesson7
Next
[Back to contents page]
http://www.vbtutor.net/lesson9.html (3 of 3) [2/23/2003 1:56:59 PM]
27. VB lesson7
Lesson 10: Introduction to VB Functions- Part I
Functions are similar to normal procedures but the main purpose of the functions is to accept certain
inputs and pass them on to the main program to finish the execution. They are two types of function, the
built-in functions(or internal functions) and the functions created by the programmers.
The general format of a function is
functionName(arguments)
where arguments are values that are passed on to the functions.
In this lesson, we are going to learn two very basic but useful internal functions, i.e. the MsgBox( ) and
InputBox ( ) functions.
10.1 MsgBox ( ) Function
The objective of MsgBox is to produce a pop-up message box and prompt the user to click on a
command button before he /she can continues. This message box format is as follows:
yourMsg=MsgBox(Prompt, Style Value, Title)
The first argument, Prompt, will display the message in the message box. The Style Value will
determine what type of command buttons appear on the message box, please refer Table 10.1 for types of
command button displayed. The Title argument will display the title of the message board.
Table 10.1: Style Values
Style Value Named Constant Buttons Displayed
0 vbOkOnly Ok button
1 vbOkCancel Ok and Cancel buttons
2 vbAbortRetryIgnore Abort, Retry and Ignore buttons.
3 vbYesNoCancel Yes, No and Cancel buttons
4 vbYesNo Yes and No buttons
5 vbRetryCancel Retry and Cancel buttons
http://www.vbtutor.net/lesson10.html (1 of 7) [2/23/2003 1:57:04 PM]
28. VB lesson7
We can use named constant in place of integers for the second argument to make the programs more
readable. Infact, VB6 will automatically shows up a list of names constant where you can select one of
them.
example: yourMsg=MsgBox( "Click OK to Proceed", 1, "Startup Menu")
and yourMsg=Msg("Click OK to Proceed". vbOkCancel,"Startup Menu")
are the same.
yourMsg is a variable that holds values that are returned by the MsgBox ( ) function. The values are
determined by the type of buttons being clicked by the users. It has to be declared as Integer data type in
the procedure or in the general declaration section. Table 10.2 shows the values, the corresponding
named constant and buttons.
Table 10.2 : Return Values and Command Buttons
Value Named Constant Button Clicked
1 vbOk Ok button
2 vbCancel Cancel button
3 vbAbort Abort button
4 vbRetry Retry button
5 vbIgnore Ignore button
6 vbYes Yes button
7 vbNo No button
Example 10.1
i. The Interface:
You draw three command buttons and a label as shown in Figure 10.1
Figure 10.1
http://www.vbtutor.net/lesson10.html (2 of 7) [2/23/2003 1:57:04 PM]
29. VB lesson7
ii. The procedure for the test button:
Private Sub Test_Click()
Dim testmsg As Integer
testmsg = MsgBox("Click to test", 1, "Test message")
If testmsg = 1 Then
Display.Caption = "Testing Successful"
Else
Display.Caption = "Testing fail"
End If
End Sub
When a user click on the test button, the image like the one shown in Figure 10.2 will appear. As the user
click on the OK button, the message "Testing sucessful" will be diplayed and when he/she clicks on the
Cancel button, the message "Testing fail" will be displayed.
Figure 10.2
http://www.vbtutor.net/lesson10.html (3 of 7) [2/23/2003 1:57:04 PM]
30. VB lesson7
To make the message box looks more sophisticated, you can add an icon besides the message. The are
four types of icons available in VB as shown in Table 10.3
Table 10.3
Value Named Constant Icon
16 vbCritical
32 vbQuestion
48 vbExclamation
64 vbInformation
Example 10.2
In this example, the following message box will be displayed:
Figure 10.3
http://www.vbtutor.net/lesson10.html (4 of 7) [2/23/2003 1:57:04 PM]
31. VB lesson7
You could draw the same Interface as in example 10.1 but modify the codes as follows:
Private Sub test2_Click()
Dim testMsg2 As Integer
testMsg2 = MsgBox("Click to Test", vbYesNoCancel + vbExclamation, "Test Message")
If testMsg2 = 6 Then
display2.Caption = "Testing successful"
ElseIf testMsg2 = 7 Then
display2.Caption = "Are you sure?"
Else
display2.Caption = "Testing fail"
End If
End Sub
10.2 The InputBox( ) Function
An InputBox( ) function will display a message box where the user can enter a value or a message in the
form of text. The format is
myMessage=InputBox(Prompt, Title, default_text, x-position, y-position)
myMessage is a variant data type but typically it is declared as string, which accept the message input bu
the users.The arguments are explained as follows:
q Prompt - The message displayed normally as a question asked.
q Title - The title of the Input Box.
q default-text - The default text that appears in the input field where users can use it as his intended
input or he may change to the message he wish to key in.
q x-position and y-position - the position or the coordinate of the input box.
http://www.vbtutor.net/lesson10.html (5 of 7) [2/23/2003 1:57:04 PM]
32. VB lesson7
Example 10.3
i. The Interface
Figure 10.4
ii. The procedure for the OK button
Private Sub OK_Click()
Dim userMsg As String
userMsg = InputBox("What is your message?", "Message Entry Form", "Enter your
messge here", 500, 700)
If userMsg <> "" Then
message.Caption = userMsg
Else
message.Caption = "No Message"
End If
End Sub
When a user click the OK button, the input box as shown in Figure 10.5 will appear. After user entering
the message and click OK, the message will be displayed on the caption, if he click Cancel, "No
http://www.vbtutor.net/lesson10.html (6 of 7) [2/23/2003 1:57:04 PM]
33. VB lesson7
message" will be displayed.
[Back to contents page]
http://www.vbtutor.net/lesson10.html (7 of 7) [2/23/2003 1:57:04 PM]
34. lesson11
Lesson 11: Introduction to VB Functions- Part II
11.1 Creating Your Own Functions
The general format of a function is as follows:
Public Function functionName (Arg As dataType,..........) As dataType
or
Private Function functionName (Arg As dataType,..........) As dataType
* Public indicates that the function is applicable to the whole program and
Private indicates that the function is only applicable to a certain module or procedure.
Example 11.1
In this example, a user can calculate future value of a certain amount of money he has today based on the
interest rate and the number of years from now(supposing he will invest this amount of money
somewhere). The calculation is based on the compound interest rate.
Public Function FV(PV As Variant, i As Variant, n As Variant) As Variant
http://www.vbtutor.net/lesson11.html (1 of 3) [2/23/2003 1:57:24 PM]
35. lesson11
'Formula to calculate Future Value(FV)
'PV denotes Present Value
FV = PV * (1 + i / 100) ^ n
End Function
Private Sub compute_Click()
'This procedure will calculate Future Value
Dim FutureVal As Variant
Dim PresentVal As Variant
Dim interest As Variant
Dim period As Variant
PresentVal = PV.Text
interest = rate.Text
period = years.Text
FutureVal = FV(PresentVal, interest, period)
MsgBox ("The Future Value is " & FutureVal)
End Sub
Example 11.2
The following program will automatically compute examination grades based on the marks that a student
obtained.
Public Function grade(mark As Variant) As String
Select Case mark
http://www.vbtutor.net/lesson11.html (2 of 3) [2/23/2003 1:57:24 PM]
36. lesson11
Case Is >= 80
grade = "A"
Case Is >= 70
grade = "B"
Case Is >= 60
grade = "C"
Case Is >= 50
grade = "D"
Case Is >= 40
grade = "E"
Case Else
grade = "F"
End Select
End Function
Private Sub compute_Click()
grading.Caption = grade(mark)
End Sub
Private Sub End_Click()
End
End Sub
[Back to contents page]
http://www.vbtutor.net/lesson11.html (3 of 3) [2/23/2003 1:57:24 PM]
37. lesson11
Lesson 12: Creating VB Functions For MS
Excel
12.2 The Needs to Create User-Defined Functions in MS-Excel
You can create your own functions to supplement the built-in functions in Microsoft Excel spreadsheet which
are quite limited. These functions could be very useful and powerful if you know how to program them properly.
One main reason we need to create user defined functions is to enable us to customize our spreadsheet
environment for individual needs. For example, we might need a function that could calculate commissions
payment based on the sales volume, which is quite difficult if not impossible by using the built-in function alone.
Lets look at the table below:
Table 12.1: Commissions Payment Table
Sales Volume($) Commissons
<500 3%
<1000 6%
<2000 9%
<5000 12%
>5000 15%
In the above table, if a saleman attain a sale volume of $6000, he will be paid $6000x12%=$720.00. A visual
basic function to calculate the commissions could be written as
follows:
Function Comm(Sales_V As Variant) as Variant
If Sales_V <500 Then
Comm=Sales_V*0.03
Elseif Sales_V>=500 and Sales_V<1000 Then
Comm=Sales_V*0.06
Elseif Sales_V>=1000 and Sales_V<2000 Then
Comm=Sales_V*0.09
Elseif Sales_V>=200 and Sales_V<5000 Then
Comm=Sales_V*0.12
Elseif Sales_V>=5000 Then
Comm=Sales_V*0.15
End If
End Function
12.2 Using Microsoft Excel Visual Basic Editor
To create User Defined functions in MS Excel, you can click on tools, select macro and then click on Visual
Basic Editor as shown in Figure 12.1
http://www.vbtutor.net/lesson12.html (1 of 4) [2/23/2003 1:57:35 PM]
38. lesson11
Figure 12.1: Inserting Ms_Excel Visual Basic Editor
Upon clicking the Visual Basic Editor, the VB Editor windows will appear as shown in figure 12.2. To create a
function, type in the function as illustrated in section 12.1 above After typing, save the
file and then return to the Excel windows.
Figure 12.2 : The VB Editor
http://www.vbtutor.net/lesson12.html (2 of 4) [2/23/2003 1:57:35 PM]
39. lesson11
In the Excel windows, type in the titles Sales Volume and Commissions in any two cells. By refering to figure
12.3, key-in the Comm function at cell C4 and by referencing the value in cell B4, using the format Comm(B4).
Any value appear in cell B4 will pass the value to the Comm function in cell C4. For the rest of the rows, just
copy the formula by draging the bottom right corner of cell C4 to the required cells, and a nice and neat table
that show the commisions will automatically appear. It can also be updated anytime
Figure 12.3: MS Excel Windows- Sales Volume
http://www.vbtutor.net/lesson12.html (3 of 4) [2/23/2003 1:57:35 PM]
41. Lesson 13
Lesson 13: Arrays
13.1 Introduction to Arrays
By definition, an array is a list of variables, all with the same data type and name. When we work with a
single item, we only need to use one variable. However, if we have a list of items which are of similar
type to deal with, we need to declare an array of variables instead of using a variable for each item. For
example, if we need to enter one hundred names, instead of declaring one hundred different variables, we
need to declare only one array. We differentiate each item in the array by using subscript, the index value
of each item, for example name(1), name(2),name(3) .......etc.
13.2 Declaring Arrays
We could use Public or Dim statement to declare an array just as the way we declare a single variable.
The Public statement declares an array that can be used throughout an application while the Dim
statement declare an array that could be used only in a local procedure.
The general format to declare an array is as follow:
Dim arrayName(subs) as dataType
where subs indicates the last subscript in the array.
Example 13.1
Dim CusName(10) as String
will declare an array that consists of 10 elements if the statement Option Base 1 appear in the declaration
area, starting from CusName(1) to CusName(10). Otherwise, there will be 11 elements in the array
starting from CusName(0) through to CusName(10)
Example 13.2
Dim Count(100 to 500) as Integer
declares an array that consists of the first element starting from Count(100) and ends at Count(500)
13.3 Sample Programs
http://www.vbtutor.net/lesson13.html (1 of 4) [2/23/2003 1:57:53 PM]
42. Lesson 13
(i)
The Interface
The codes
Dim studentName(10) As String
Dim num As Integer
Private Sub addName()
For num = 1 To 10
studentName(num) = InputBox("Enter the student name", "Enter Name", "", 1500, 4500)
If studentName(num) <> "" Then
Form1.Print studentName(num)
Else
End
End If
http://www.vbtutor.net/lesson13.html (2 of 4) [2/23/2003 1:57:53 PM]
43. Lesson 13
Next
End Sub
Private Sub Exit_Click()
End
End Sub
Private Sub Start_Click()
Form1.Cls
addName
End Sub
The above program accepts data entry through an input box and displays the entries in the form itself. As
you can see, this program will only allows a user to enter 10 names each time he click on the start button.
(ii)
The Interface
http://www.vbtutor.net/lesson13.html (3 of 4) [2/23/2003 1:57:53 PM]
44. Lesson 13
The Codes
Dim studentName(10) As String
Dim num As Integer
Private Sub addName( )
For num = 1 To 10
studentName(num) = InputBox("Enter the student name")
List1.AddItem studentName(num)
Next
End Sub
Private Sub Start_Click()
addName
End Sub
The above program accepts data entries through an InputBox and displays the items in a list box.
[Back to contents page]
http://www.vbtutor.net/lesson13.html (4 of 4) [2/23/2003 1:57:53 PM]
45. lesson14
Lesson 14: Working with Files
14.1 Introduction
Up until lesson 13 we are only creating programs that could accept data at runtime, when a program is
terminated, the data also disappear. Is it possible to save data accepted by a VB
program into a storage device, such as a hardisk or diskette, or even CDRW? The answer is possible. Is
this chapter, we will learn how to create files by writing them into a storage device and then retrieve the
data by reading the contents of the files using customized VB programs.
14.2 Creating files
To create a file , use the following command
Open "fileName" For Output As #fileNumber
Each file created must have a file name and a file number for identification. As for file name, you must
also specify the path where the file will reside.
For example
Open "c:My Documentssample.txt" For Output As #1
will create a text file by the name of sample.txt in the My Document folder. The accompany file number
is 1. If you wish to create and save the file in A drive, simply change the path, as follows"
Open "A:sample.txt" For Output As #1
If you wish to create a HTML file , simple change the extension to .html
Open "c:My Documentssample.html" For Output As # 2
14.2.1 Sample Program : Creating a text file
Private Sub create_Click()
Dim intMsg As String
Dim StudentName As String
Open "c:My Documentssample.txt" For Output As #1
intMsg = MsgBox("File sample.txt opened")
http://www.vbtutor.net/lesson14.html (1 of 2) [2/23/2003 1:57:59 PM]
46. lesson14
StudentName = InputBox("Enter the student Name")
Print #1, StudentName
intMsg = MsgBox("Writing a" & StudentName & " to sample.txt ")
Close #1
intMsg = MsgBox("File sample.txt closed")
End Sub
* The above program will create a file sample.txt in the My Documents' folder and ready to receive input
from users. Any data input by users will be saved in this text file.
14.3 Reading files
To read a file created in section 14.2, you can use the input # statemment. However, we can only read
the file according to the format when it was written. You have to open the file according to its file
number and the variable that hold the data. We also need to declare the variable using the DIM
command.
14.3.1 Sample Program: Reading file
Private Sub Reading_Click()
Dim variable1 As String
Open "c:My Documentssample.txt" For Input As #1
Input #1, variable1
Text1.Text = variable1
Close #1
End Sub
* This program will open the sample.txt file and display its contents in the Text1 textbox.
Back to contents page]
http://www.vbtutor.net/lesson14.html (2 of 2) [2/23/2003 1:57:59 PM]
47. Lesson 15
Lesson 15: Creating Multimedia Applications
You can create various multimedia applications in VB that could play audio CD,
audiofiles, VCD , video files and etc.
To be able to play multimedia files or multimedia devices, you have to insert
Microsoft Multimedia Control into your VB applications
that you are going to create. However, Microsoft Multimedia Control is not
normally included in the startup toolbox, therefore you need
to add the MM control by pressing Ctrl+T and select it from the components
dialog box that is displayed.
15.1 Creating a CD player
(a) The Interface.
¡¡
http://www.vbtutor.net/lesson15.htm (1 of 3) [2/23/2003 1:58:06 PM]
48. Lesson 15
¡¡
First of all, you place a Multimedia control into your form and rename it as any
name of your choice. Here I use myCD to replace the default name MMControl1.
Next, you can put two labels on your form, change caption of the left label to
Track and rename the one on the right to trackNum and make its caption
invisible(this lable is to display CD track numbers at runtime.). Finally, put five
command buttons in your form and name them as Play, Next, Previous, Stop and
Exit. You can also choose to make the MM Control visible or invisible at
runtime. If you choose to make it visible,you could play the CD using the buttons
available on the control itself or you can click on the buttons at the bottom that
are created by you.
(b) The Code
Private Sub Form_Load()
¡®To position the page at the center
Left = (Screen.Width ¨C Width) 2
Top = (Screen.Height ¨C Height) 2
¡®Open the CD
myCD.Command = ¡°Open¡±
End Sub
Private Sub myCD_StatusUpdate()
¡®Update the track number
trackNum.Caption = myCD.Track
End Sub
Private Sub Next_Click()
myCD.Command = ¡°Next¡±
End Sub
http://www.vbtutor.net/lesson15.htm (2 of 3) [2/23/2003 1:58:06 PM]
49. Lesson 15
Private Sub Play_Click()
myCD.Command = ¡°Play¡±
End Sub
Private Sub Previous_Click()
myCD.Command = ¡°Prev¡±
End Sub
Private Sub Stop_Click()
myCD.Command = ¡°Stop¡±
End Sub
Private Sub Exit_Click()
End
End Sub
[Back to Content Page]
http://www.vbtutor.net/lesson15.htm (3 of 3) [2/23/2003 1:58:06 PM]
50. The Interface
¡¡
Lesson 16: Creating Multimedia Applications-Part 2
In previous lesson, we have programmed a CD player. Now, with some modifications, we will
transform the CD player into an audio file player. This player will be created in such a way that
it could search for wave and midi files in your drives and play them.
In this project, you need to insert a ComboBox, a DriveListBox, a DirListBox, a TextBox and a
FileListBox into your form.I Shall briefly discuss the function of each of the above controls.
Besides, you must also insert Microsoft Multimedia Control(MMControl) in your form , you may
make it visible or invisible. In my program, I choose to make it invisible so that I could use the
command buttons created to control the player.
q ComboBox- to display and enable selection of different type of files.
q DriveListBox- to allow selection selection of different drives available on your PC.
q DirListBox - To display directories
q TextBox - To display selected files
q FileListBox- To display files that are available
Relevant codes must be written to coordinate all the above controls so that the application can
work properly. The program should flow in the following logical way:
Step 1: User choose the type of files he wants to play.
Step2:User selects the drive that might contains the relevant audio files.
Step 3:User looks into directories and subdirectories for the files specified in step1. The files
should be displayed in the FileListBox.
Step 4: User selects the files from the FileListBox and click the Play button.
Step 5: User click on the Stop to stop playing and Exit button to end the application.
The Interface
http://www.vbtutor.net/lesson16.htm (1 of 5) [2/23/2003 1:58:13 PM]
51. The Interface
¡¡
The Code
Private Sub Combo1_Change()
' to determine file type
If ListIndex = 0 Then
File1.Pattern = ("*.wav")
ElseIf ListIndex = 1 Then
File1.Pattern = ("*.mid")
Else
Fiel1.Pattern = ("*.*")
End If
End Sub
Private Sub Dir1_Change()
'To change directories and subdirectories(or folders and subfolders)
File1.Path = Dir1.Path
http://www.vbtutor.net/lesson16.htm (2 of 5) [2/23/2003 1:58:13 PM]
52. The Interface
If Combo1.ListIndex = 0 Then
File1.Pattern = ("*.wav")
ElseIf Combo1.ListIndex = 1 Then
File1.Pattern = ("*.mid")
Else
File1.Pattern = ("*.*")
End If
End Sub
Private Sub Drive1_Change()
'To change drives
Dir1.Path = Drive1.Drive
End Sub
Private Sub File1_Click()
If Combo1.ListIndex = 0 Then
File1.Pattern = ("*.wav")
ElseIf Combo1.ListIndex = 1 Then
File1.Pattern = ("*.mid")
Else
File1.Pattern = ("*.*")
End If
If Right(File1.Path, 1) <> "" Then
filenam = File1.Path + "" + File1.FileName
Else
filenam = File1.Path + File1.FileName
End If
Text1.Text = filenam
End Sub
Private Sub Form_Load()
'To center the Audioplayer startup page
Left = (Screen.Width - Width) 2
Top = (Screen.Height - Height) 2
Combo1.Text = "*.wav"
http://www.vbtutor.net/lesson16.htm (3 of 5) [2/23/2003 1:58:13 PM]
53. The Interface
Combo1.AddItem "*.wav"
Combo1.AddItem "*.mid"
Combo1.AddItem "All files"
End Sub
Private Sub AudioPlayer_Click()
End Sub
Private Sub play_Click()
'To play WaveAudio file or Midi File
Command2_Click
If Combo1.ListIndex = 0 Then
AudioPlayer.DeviceType = "WaveAudio"
ElseIf Combo1.ListIndex = 1 Then
AudioPlayer.DeviceType = "Sequencer"
End If
AudioPlayer.FileName = Text1.Text
AudioPlayer.Command = "Open"
AudioPlayer.Command = "Play"
End Sub
Private Sub stop_Click()
If AudioPlayer.Mode = 524 Then Exit Sub
If AudioPlayer.Mode <> 525 Then
AudioPlayer.Wait = True
AudioPlayer.Command = "Stop"
End If
AudioPlayer.Wait = True
AudioPlayer.Command = "Close"
End Sub
Private Sub Exit_Click()
End
End Sub
¡¡
http://www.vbtutor.net/lesson16.htm (4 of 5) [2/23/2003 1:58:13 PM]
54. The Interface
[Back to Content Page]
http://www.vbtutor.net/lesson16.htm (5 of 5) [2/23/2003 1:58:13 PM]
55. Lesson 16
Lesson 17: Creating Multimedia Applications-Part 3
In lesson 16, we have created an audio player. Now, with some modifications, we will transform the audio player into
a picture viewer. This player will be created in such a way that it could search for all types of graphics your drives
and play them.
Similar to the previous project, in this project, you need to insert a ComboBox, a DriveListBox, a DirListBox, a
TextBox and a FileListBox into your form. I Shall brieflyexplain again the function of each of the above controls.
q ComboBox- to display and enable selection of different type of files.
q DriveListBox- to allow selection selection of different drives available on your PC.
q DirListBox - To display directories
q TextBox - To display selected files
q FileListBox- To display files that are available
Relevant codes must be written to coordinate all the above controls so that the application can work properly. The
program should flow in the following logical way:
Step 1: User choose the type of files he wants to play.
Step2:User selects the drive that might contains the relevant graphic files.
Step 3:User looks into directories and subdirectories for the files specified in step1. The files should be displayed in
the FileListBox.
Step 4: User selects the files from the FileListBox and click the Show button.
Step 5: User click on Exit button to end the application.
¡¡
The Interface
http://www.vbtutor.net/lesson17.html (1 of 4) [2/23/2003 1:58:21 PM]
56. Lesson 16
[Test run the program]
The Code
Private Sub Form_Load()
Left = (Screen.Width - Width) 2
Top = (Screen.Height - Height) 2
Combo1.Text = "All graphic files"
Combo1.AddItem "All graphic files"
Combo1.AddItem "All files"
End Sub
¡¡
Private Sub Combo1_Change()
If ListIndex = 0 Then
http://www.vbtutor.net/lesson17.html (2 of 4) [2/23/2003 1:58:21 PM]
57. Lesson 16
File1.Pattern = ("*.bmp;*.wmf;*.jpg;*.gif")
Else
Fiel1.Pattern = ("*.*")
End If
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
File1.Pattern = ("*.bmp;*.wmf;*.jpg;*.gif")
End Sub
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub
Private Sub Exit_Click()
End
End Sub
Private Sub File1_Click()
If Combo1.ListIndex = 0 Then
File1.Pattern = ("*.bmp;*.wmf;*.jpg;*.gif")
Else
File1.Pattern = ("*.*")
End If
If Right(File1.Path, 1) <> "" Then
filenam = File1.Path + "" + File1.FileName
Else
filenam = File1.Path + File1.FileName
End If
Text1.Text = filenam
End Sub
Private Sub play_Click()
MMPlayer.FileName = Text1.Text
End Sub
Private Sub show_Click()
If Right(File1.Path, 1) <> "" Then
filenam = File1.Path + "" + File1.FileName
Else
filenam = File1.Path + File1.FileName
End If
http://www.vbtutor.net/lesson17.html (3 of 4) [2/23/2003 1:58:21 PM]
58. Lesson 16
picture1.Picture = LoadPicture(filenam)
End Sub
[Back to Content Page]
¡¡
http://www.vbtutor.net/lesson17.html (4 of 4) [2/23/2003 1:58:21 PM]
59. Lesson 16
Lesson 18: Creating Multimedia Applications-Part
4: A Multimedia Player
In lesson 16, we have created an audio player. Now, with some modifications, we will transform
the audio player into a multimedia player that could play all kinds of movie files besides audio
files. This player will be created in such a way that it could search for all types of graphics your
drives and play them.
In this project, you need to insert a ComboBox, a DriveListBox, a DirListBox, a TextBox ,a
FileListBox and a picture box(for playing movie) into your form. I Shall briefly discuss the
function of each of the above controls. Besides, you must also insert Microsoft Multimedia
Control(MMControl) in your form , you may make it visible or invisible. In my program, I choose
to make it invisible so that I could use the command buttons created to control the player.
q ComboBox- to display and enable selection of different type of files.
q DriveListBox- to allow selection selection of different drives available on your PC.
q DirListBox - To display directories
q TextBox - To display selected files
q FileListBox- To display files that are available
Relevant codes must be written to coordinate all the above controls so that the application can
work properly. The program should flow in the following logical way:
Step 1: User choose the type of files he wants to play.
Step2:User selects the drive that might contains the relevant audio files.
Step 3:User looks into directories and subdirectories for the files specified in step1. The files
should be displayed in the FileListBox.
Step 4: User selects the files from the FileListBox and click the Play button.
Step 5: User click on the Stop to stop playing and Exit button to end the application.
¡¡
The Interface
http://www.vbtutor.net/lesson18.html (1 of 5) [2/23/2003 1:58:27 PM]
60. Lesson 16
¡¡
[Test run the program]
¡¡
The Code
Private Sub Form_Load()
Left = (Screen.Width - Width) 2
Top = (Screen.Height - Height) 2
Combo1.Text = "*.wav"
Combo1.AddItem "*.wav"
Combo1.AddItem "*.mid"
Combo1.AddItem "*.avi;*.mpg"
Combo1.AddItem "All files"
http://www.vbtutor.net/lesson18.html (2 of 5) [2/23/2003 1:58:27 PM]
61. Lesson 16
End Sub
Private Sub Combo1_Change()
If ListIndex = 0 Then
File1.Pattern = ("*.wav")
ElseIf ListIndex = 1 Then
File1.Pattern = ("*.mid")
ElseIf ListIndex = 2 Then
File1.Pattern = ("*.avi;*.mpg")
Else
Fiel1.Pattern = ("*.*")
End If
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
If Combo1.ListIndex = 0 Then
File1.Pattern = ("*.wav")
ElseIf Combo1.ListIndex = 1 Then
File1.Pattern = ("*.mid")
ElseIf Combo1.ListIndex = 2 Then
File1.Pattern = ("*.avi;*.mpg")
Else
File1.Pattern = ("*.*")
End If
End Sub
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub
Private Sub Exit_Click()
End
End Sub
Private Sub File1_Click()
If Combo1.ListIndex = 0 Then
File1.Pattern = ("*.wav")
ElseIf Combo1.ListIndex = 1 Then
File1.Pattern = ("*.mid")
ElseIf Combo1.ListIndex = 2 Then
http://www.vbtutor.net/lesson18.html (3 of 5) [2/23/2003 1:58:27 PM]
62. Lesson 16
File1.Pattern = ("*.avi;*.mpg")
Else
File1.Pattern = ("*.*")
End If
If Right(File1.Path, 1) <> "" Then
filenam = File1.Path + "" + File1.FileName
Else
filenam = File1.Path + File1.FileName
End If
Text1.Text = filenam
End Sub
Private Sub MMPlayer_Click()
End Sub
Private Sub Picture1_Click()
End Sub
Private Sub play_Click()
MMPlayer.FileName = Text1.Text
MMPlayer.Command = "Open"
MMPlayer.Command = "Play"
MMPlayer.hWndDisplay = videoscreen.hWnd
End Sub
Private Sub stop_Click()
If MMPlayer.Mode = 524 Then Exit Sub
If MMPlayer.Mode <> 525 Then
MMPlayer.Wait = True
MMPlayer.Command = "Stop"
End If
MMPlayer.Wait = True
MMPlayer.Command = "Close"
End Sub
[Back to Content Page]
http://www.vbtutor.net/lesson18.html (4 of 5) [2/23/2003 1:58:27 PM]
64. Amazon.com: Microsoft Visual Basic .NET Standard: Explore similar items
Your Gold Box
Search: Browse:
You clicked on this item...
Icon Microsoft Visual Basic .NET Standard
by Microsoft
Average Customer Review: 2.5 out of
5 starsUsually ships in 24 hours
This item ships for FREE with Super Saver Shipping. See details.
Amazon.com.uk
More than just a programming language, Visual Basic .NET is a visual development
tool for Windows. Building an application is a matter of first creating a visual
interface using the drag-and-drop form designer, and then writing code to bring the
interface to life. Visual Basic is popular with... Read more
List Price: $109.00
Price: $99.99
You Save: $9.01 (
8%)
Special Offers: $20.00
Price After Special
Offers:
$79.99
Or buy used: $85.00
You may also be interested in these items...
Show items that are:
Closely Related
Moderately Related
Loosely Related
http://www.amazon.com/exec/obidos/ASIN/B00005RV4Y/liewvoonkiong/103-9001279-9034233 [2/23/2003 2:18:04 PM]
Software Go! All Categories Go!
Add to Shopping Cart
Add to my Wish List
q
Submit Query