An InputBox( ) function will display an input Box window where the user can enter a value or a text. The format is

Similar documents
Understanding the MsgBox command in Visual Basic

Programming Concepts and Skills. Arrays continued and Functions

Programming with visual Basic:

variables programming statements

Excel & Visual Basic for Applications (VBA)

VBA. VBA at a glance. Lecture 61

6/14/2010. VBA program units: Subroutines and Functions. Functions: Examples: Examples:

Visual Programming 1. What is Visual Basic? 2. What are different Editions available in VB? 3. List the various features of VB

IFA/QFN VBA Tutorial Notes prepared by Keith Wong

MICROSOFT EXCEL 2000 LEVEL 5 VBA PROGRAMMING INTRODUCTION

Control Properties. Example: Program to change background color

MgtOp 470 Business Modeling with Spreadsheets Sample Midterm Exam. 1. Spreadsheets are known as the of business analysis.

3 IN THIS CHAPTER. Understanding Program Variables

Creating Macros David Giusto, Technical Services Specialist, Synergy Resources

MICROSOFT EXCEL VISUAL BASIC FOR APPLICATIONS INTERMEDIATE

Lab Manual Visual Basic 6.0

Excel Macro Record and VBA Editor. Presented by Wayne Wilmeth

Excel VBA Programming

EMPLOYEE PAYROLL SYSTEM

ต วอย างการสร างฟอร ม เมน การใช งาน

Respond to Data Entry Events

The Control Properties

2Practicals Visual Basic 6.0

As an A+ Certified Professional, you will want to use the full range of

LAMPIRAN. Universitas Sumatera Utara

I

LAMPIRAN LIST PROGRAM

INFORMATICS: Computer Hardware and Programming in Visual Basic 81

Lookup Project. frmlookup (Name: object is a combo box, style 2); use 4 labels: 2 for phone, 2 for mail. MsgBox Function:

Universitas Sumatera Utara

The first step you should take in order to be able to use the system is accessing our web page. Follow these steps to gain access to the system:

Visual Basic 6 Lecture 7. The List Box:

Visual Basic ,

A Back-End Link Checker for Your Access Database

TABLE OF CONTENTS ADVANCED VISUAL BASIC

Year 12 : Visual Basic Tutorial.

Rooftop Industries Pvt. Ltd.

Visual Basic , ,. Caption Hello, On Off. * + +, -. 1-Arrow, , 2- Cross. - project1.vbp, 4-form1.frm.

ENGG1811 Computing for Engineers Week 9 Dialogues and Forms Numerical Integration

Function: function procedures and sub procedures share the same characteristics, with

How-To Guide. SigIDp (With Microsoft Access) Demo. Copyright Topaz Systems Inc. All rights reserved.

Access VBA programming

Use Default Form Instances

Visual Basic ,

Agenda. First Example 24/09/2009 INTRODUCTION TO VBA PROGRAMMING. First Example. The world s simplest calculator...

MULTI-FACTOR AUTHENTICATION SET-UP

IS 320 Spring 96 Page 1 Exam 1. Please use your own paper to answer the following questions. Point values are shown in parentheses.

LAMPIRAN A LISTING PROGRAM. Universitas Sumatera Utara

LISTING PROGRAM. 1. Form Login. Private Sub BATAL_Click() End End Sub

Use Do Until to break links

AIM To analyze, design and develop code for Online Course Reservation System using Rational Rose software

Alternatives To Custom Dialog Box

NATIONAL DIPLOMA IN COMPUTER TECHNOLOGY

Microsoft Access 2010 Level III

1. In Outlook click on the blue (2013) or yellow (2010) File tab in the top left corner of the window. 2. Click on + Add Account

Wireless n PC Card install guide Model

Best Practices Benchmarking Application

XRY Viewer User Guide

HOWTO Make an Initial Connection to the Office Anywhere Desktop using a Windows 7 based PC v1

DATABASE AUTOMATION USING VBA (ADVANCED MICROSOFT ACCESS, X405.6)

Mr.Khaled Anwar ( )

19. VB Project and Menu Design

Click File on the menu bar to view the individual menu items and their associated icons on the File menu.

Accessing the Jobs Fund Online Application Portal

Finalizing the Project

Lab - Remote Desktop in Windows 8

Please answer questions in the space provided. Question point values are shown in parentheses.

Annual Performance Assessment Process Additional Comments Guide

Hands-On-8 Advancing with VBA

Lab - Remote Desktop in Windows 7 and Vista

Configuring Microsoft Outlook to Connect to Hosted Exchange Service

SAP Business Client Quick Start Guide

Learning VB.Net. Tutorial 11 Functions

APPLICATION PORTAL GUIDE

Super USB. User Manual. 2007, March

Barchard Introduction to SPSS Marks

MFA (Multi-Factor Authentication) Enrollment Guide

DATA-CONTROLLED POWER SUPPLY 3645A-TYPE. Operating Manual

BANNER 9 NAVIGATION TIPS 03/26/2018. Next Block. Bottom right of page. Upper right of page. Bottom right of filter page or. Bottom right of pop-up box

Barchard Introduction to SPSS Marks

How to set up an Amazon Work Profile for Windows 8

Additional Information

How do I apply the patch files?

Instructions for Login to STAR through MyApps Updated 2/22/2012

University of Technology Laser & Optoelectronics Engineering Department Visual basic Lab.

AlphaCam Routing Example

Chapter 14 Sequential Files

VBA Macro for Micro Focus Reflections Face-to-Face Orlando March 2018

JEE2600 INTRODUCTION TO DIGITAL LOGIC AND COMPUTER DESIGN. ModelSim Tutorial. Prepared by: Phil Beck 9/8/2008. Voter Function

AxoNet Software GmbH. Introduction. Using the AxClient components for asanetwork

VBScript: Math Functions

How do I apply the patch files? The instructions shown here are only for the version patch.

CMPT 110 MIDTERM OCTOBER 18, 2001

You will have mastered the material in this chapter when you can:

Professional Services. Desktop Wallboard. Programmer Guide. Release Avaya Inc. Proprietary Use Pursuant to Company Instructions

Epicollect5 Reference Guide

WORKFLOW TRAINING. Reviewing an Agenda Item Through Laserfiche Client. Updated May 2017

Lab 3: Editing a Rhapsody Model in RMM

N2KAnalyzer. User s Manual

Contents Introduction Getting Started Visual Basic Form Configuration Entering the VB Code

Transcription:

InputBox( ) Function An InputBox( ) function will display an input Box window where the user can enter a value or a text. The format is A = InputBox ( Question or Phrase, Window Title, ) Example1: Integer: if you input numbers in the InputBox. String: if you input Text in the InputBox. Dim a As string a = InputBox("What is your full name?", "Input Box Example", " ") 1

Notes: 1. If we Dim a variable as a string or integer, then the variable = InputBox( PUT ALL STATEMENT INSIDE BRACKETS). 2. If we use InputBox directly without Dim, then InputBox NO NEED FOR BRACKETS. Example2: Using inputbox method, changing the background color of the form. Solution: Code: Dim a As String a = InputBox("What is your name?", "Background Color", "") If a = "Your Name" Then Form1.BackColor = vbred 2

Example3: Using inputbox method, showing your name in the TextBox if the InputBox Number = 10. Solution: Code: Dim a As Integer a = InputBox("What is the Number?", "Input Example"," ") If a = "10" Then Text1.Text = "Your Name" 3

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 to confirm specific condition. This message box format is as follows: MsgBox Answer or Phrase, vbinformation + vbyesno, Window Title Notes: 3. If we Dim a variable as a string or integer, then the variable = MsgBox( PUT ALL STATEMENT INSIDE BRACKETS). See example5 4. If we use MsgBox directly without Dim, then MsgBox NO NEED FOR BRACKETS. 5. In MsgBox method doesn t matter if we Dim as an Integer or as a String. 4

Icons: Constant Value Description vbcritical 16 Display Critical message icon vbquestion 32 Display Warning Query icon vbexclamation 48 Display Warning message icon vbinformation 64 Display information icon Buttons: Constant Value Description vbokonly 0 Display OK button only vbokcancel 1 Display OK and Cancel buttons vbabortretryignore 2 vbyesnocancel 3 Display Abort, Retry and Ignore buttons Display Yes, No and Cancel buttons vbyesno 4 Display Yes and No buttons vbretrycancel 5 Display Retry and Cancel buttons 5

Example4: Using inputbox method and MsgBox, showing your name in the Text box if the InputBox Number = 10 then (Correct Number), if not then (Wrong Number). Use icons with MsgBox. Solution: Code: Dim a As Integer a = InputBox("What is the Number?", "Input Example"," ") If a = "10" Then MsgBox "Correct Number", vbinformation + vbyesno, "Check Window" Text1.text="your name" Else MsgBox "Wrong Number", vbcritical, "Check Window" Text1.text=" " 6

Example5: Using MsgBox method, showing that when click Yes, the form background color changes to Red, if not changes to Black. Use icons with MsgBox. Solution: Code: Dim a As Integer a = MsgBox("Red or Black", vbinformation + vbyesno, "Check Window") If a = vbyes Then Form1.BackColor = vbred Else Form1.BackColor = vbblack 7

Example6: Design a Visual Basic Program to create a User Name and Password form to log in into another form (backcolor Blue), using command button, textboxes, MsgBoxes for error and exit. Solution: Adding new Form method 1 Select Form 8

Adding new Form method 2 Code: Dim a As String If Text1.Text = "Any Name" And Text2.Text = "Any Thing" Then Form1.Hide Form2.Show Else MsgBox "Wrong User Name or Password", vbcritical + vbokonly, "Warning" 9

Form1: Private Sub Form_Unload(Cancel As Integer) a = MsgBox("Are you sure you want to exit", vbquestion + vbyesno, "Warning") If a = vbyes Then End Else Cancel = 1 Means not end Choosing Unload helping in Cancelling Code Questions: 1. Using InputBox method, change the color of your name in the TextBox. 2. Using MsgBox method, make Command1 (invisible) and Command2 (visible) when click on Command1, and vice versa when click on Command2. 3. Using InputBox and MsgBox method, comparing between Even and Odd numbers. 10