Visual Basic. The Close Method The Close method is used to close a form. To close a form use the keyword Me to refer to the form. Me.Close()

Slides:



Advertisements
Similar presentations
Office 2003 Post-Advanced Concepts and Techniques M i c r o s o f t Excel Project 7 Using Macros and Visual Basic for Applications (VBA) with Excel.
Advertisements

Objectives Understand the software development lifecycle Perform calculations Use decision structures Perform data validation Use logical operators Use.
UI Prototyping with VB 6.0 SIMS213 Tutorial March 5, 1999 Melody Y. Ivory.
String Variables Visual Basic for Applications 4.
Input Validation Check the values entered into a text box before beginning any calculations Validation is a form of ‘self-protection’, rejecting bad data.
Input and Message Boxes. InputBox() Function An input box is a dialog box that opens and waits for the user to enter information. Syntax: InputBox(prompt[,title][,default])
Using the Visual Basic Editor Visual Basic for Applications 1.
Input Validation Check the values entered into a text box before beginning any calculations Validation is a form of ‘self-protection’, rejecting bad data.
Instructor: Adil Ibrahim Office: 212 Ullrich Phone: ibrahima 1.
Microsoft Visual Basic 2005 CHAPTER 8 Using Procedures and Exception Handling.
WORKING WITH MACROS CHAPTER 10 WORKING WITH MACROS.
Visual Basic Fundamental Concepts. Integrated Development Enviroment Generates startup form for new project on which to place controls. Features toolbox.
Visual Basic 2008 Express Edition The IDE. Visual Basic 2008 Express The Start Page Recent Projects Open an existing project Create a New Project.
Hello World In C++ and Microsoft Visual C++. Directions to begin a project 1. Go to All Programs 2. Open Visual Studio C++ 3. Click on New Project 4.
© 1999, by Que Education and Training, Chapter 5, pages of Introduction to Computer Programming with Visual Basic 6: A Problem-Solving Approach.
Microsoft Visual Basic 2012 Using Procedures and Exception Handling CHAPTER SEVEN.
Saeed Ghanbartehrani Summer 2015 Lecture Notes #4: Working with Variables and User Interfaces IE 212: Computational Methods for Industrial Engineering.
Microsoft Visual Basic 2008 CHAPTER 8 Using Procedures and Exception Handling.
1 Visual Basic for Applications (VBA) for Excel Prof. Yitzchak Rosenthal.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 1B Introduction (Tutorial)
Chapter 3 Introducing Visual Basic.NET. 3.1 Visual Basic.NET Windows Programming -Used to create Windows, Web, and Console applications -Uses predefined.
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 7 Using Menus, Common Dialogs, Procedures, Functions, and Arrays.
Chapter One An Introduction to Visual Basic 2010 Programming with Microsoft Visual Basic th Edition.
Visual Basic.NET Windows Forms Hello World Homework Assignment.
Microsoft Visual Basic 2008: Reloaded Third Edition Chapter Six The Do Loop and List Boxes.
CS0004: Introduction to Programming Project 1 – Lessons Learned.
Applications Development
1 Creating Windows GUIs with Visual Studio. 2 Creating the Project New Project Visual C++ Projects Windows Forms Application Give the Project a Name and.
Repetition Statements
Variables & Function Calls. Overview u Variables  Programmer Defined & Intrinsic  Data Types  Calculation issues u Using Functions  The val() function.
1 Scripting Languages VBScript - Recognized mainly by Internet Explorer only - Netscape does have a plug-in JavaScript - Recognized by Internet Explorer.
Visual Basic for Application - Microsoft Access 2003 Programming applications using Objects.
Macro’s Within excel. Most functionality can be driven from VBA VBA is the programming language that runs inside of excel. It uses visual basic as the.
ME 142 Engineering Computation I Input, Output & Documentation.
Created by Alia Al-Abdulkarim 2008 Visual Basic Vs. Java.
Chapter 4 Getting Started with VBA. Subroutines Subroutine is the logical section of code that performs a particular task. Subroutine is also called a.
Controlling Program Flow with Looping Structures
Visual Basic.net Functions. Function (Defined) A procedure that returns a value when called.
© by Pearson Education, Inc. All Rights Reserved.-Edited By Maysoon Al-Duwais 2.
2c – Textboxes and Buttons Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming.
Microsoft Visual Basic 2012 CHAPTER FOUR Variables and Arithmetic Operations.
COMPREHENSIVE Access Tutorial 11 Using and Writing Visual Basic for Applications Code.
JavaScript Events Java 4 Understanding Events Events add interactivity between the web page and the user You can think of an event as a trigger that.
ME 142 Engineering Computation I Interacting with Spreadsheets.
Addison Wesley is an imprint of © 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Chapter 3 Variables and Calculations.
JavaScript Events. Understanding Events Events add interactivity between the web page and the user Events add interactivity between the web page and the.
Using Forms and Form Elements In Visual Basic.NET.
Visual Basic Declaring Variables Dim x as Integer = 0 In the statement above, x is being declared as an Integer (whole number) and is initialised.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 6 Looping and Multiple Forms.
Chapter 6 Controlling Program Flow with Looping Structures.
COMPUTER PROGRAMMING I Apply Procedures to Develop List Box and Combo Box Objects.
Visual Basic Fundamental Concepts
A variable is a name for a value stored in memory.
Apply Procedures to Develop Message, Input, and Dialog Boxes
GUI Programming using Windows Form
Using Procedures and Exception Handling
Microsoft Office Illustrated
Objectives Learn about Function procedures (functions), Sub procedures (subroutines), and modules Review and modify an existing subroutine in an event.
Variables and Arithmetic Operations
Visual Basic..
CIS16 Application Development Programming with Visual Basic
Messages and Input boxes
CIS16 Application Development and Programming using Visual Basic.net
Control Structures Part B - Message and Input Boxes
Additional Topics in VB.NET
Introduction to Programming
Classes.
Presentation transcript:

Visual Basic

The Close Method The Close method is used to close a form. To close a form use the keyword Me to refer to the form. Me.Close()

Msgbox PromptText Icon Buttons Dialog title

Msgbox -Parameters The message box function takes 3 main parameters: Msgbox (Prompt Text, Buttons+Icon, DialogTitle) [ Prompt is a string which contains the message. ] Button Constant vbOKOnly vbOkCancel vbYesNo vbYesNoCancel vbAbortRetryIgnore vbRetryCancel Icon ConstantIcon vbQuestion vbInformation vbExclamation vbCritical

Msgbox -Example Dim Ans As String Ans = Msgbox("Are you sure?", vbYesNo+vbExclamation,- "Front Page Editor") OR Ans = MessageBox.Show("Are you sure", "FrontPage Editor", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation)

InputBox InputBox: predefined dialog box that includes a prompt, a textbox, and an OK and Cancel buttons. It is used to get information from the user. Prompt: question or instruction for the user. Title: for InputBoxes, the text that appears in the blue bar at the top

Input Box PromptText DefaultText DialogTitle

Parameters: The input box function takes three main parameters: InputBox ( PromptText, DialogTitle, DefaultText) Example: Dim DocName As String DocName = InputBox ("Please enter the documents title", _ "Enter Title", "Document 1") Input Box

Specific Example Dim strUserName As String strUserName = InputBox(“What is your name?”, “Request Name”) If the user enters no text, or presses the cancel button, then the InputBox function will return the value Nothing. You can check for this in your code: If strUserName = Nothing Then MessageBox.show(“Cancelled”) End Ifz If the user has entered some text into the textbox and pressed the OK button, then the text they entered is now saved in the variable strUserName. Input Box

Space Function Used to add spaces to your string. Just call it and send to it the number of spaces you want. Example: Dim Str1 as String = “Hello” & Space(5) & “, You just add 5 spaces” MsgBox(Str1)

Progress bar Progress bars are used to display the progress of your application or background tasks. There are three members of the ProgressBar control you should know about: the Maximum, the Minimum, and the Value properties.

Status Bar Status Bars are used to display status messages at the bottom of the form. They are generally used to provide additional information, such as page numbers, display a message, etc.

Random Numbers -Declaration Dim randomNumber As Random = New Random Variable nameData typeInitialization

Random Numbers -Methods  Next()  Non-negative random integer  NextDouble()  A double between 0.0 and 1.0  Next(IntegerValue)  A positive integer < IntegerValue  Next(IntValue1,IntValue2)  IntValue1 <= an integer < IntValue2

Random Numbers -Example Dim randomNumber As Random randomNumber = New Random Dim number As Integer number = randomNumber.Next(10, 20) MsgBox(number)

Design view Code view b1 Private Sub LotsOfButtons(ByVal sender As _ System.Object,ByVal e As System.EventArgs) _ Handles Button1.Click, Button2.Click, Button3.Click, Button4.Click label1.text = sender.text & “ is clicked” End Sub b2 b3 b4 Name : label1 3. Multiple Events by Single Handler

Design view code view b1 b2 b3 b4 b3 is clicked Name : label1 The sender argument provides information about the object that raises the event 3. Multiple Events by Single Handler Private Sub LotsOfButtons(ByVal sender As _ System.Object,ByVal e As System.EventArgs) _ Handles Button1.Click, Button2.Click, Button3.Click, Button4.Click label1.text = sender.text & “ is clicked” End Sub

Why do you need to know this ? In sheet 3, you can handle clicking all the 26 letters by single event handler. Each time just get the sender.text to check the letter chosen !!!!