Department Array in Visual Basic

Slides:



Advertisements
Similar presentations
5.04 Apply Decision Making Structures
Advertisements

Exploring Office Grauer and Barber 1 Creating More Powerful Applications: Introduction to VBA(Wk9)
To type the VB code behind the command button (named cmdPush), Double-Click on the Push Me (caption) command button As a result the Visual Basic Code Window.
Muffin Shop - if, calculations etc. (muffins, muffins2) Please use speaker notes for additional information!
Adding Controls to User Forms. Adding Controls A user form isn’t much use without some controls We’re going to add controls and write code for them Note.
3/9/2004 PPCC - Introduction to VB6 Copyright ©2004, Tore Bostrup 1 Introduction to VB6 Week 2.
Visual Basic Fundamental Concepts. Integrated Development Enviroment Generates startup form for new project on which to place controls. Features toolbox.
© 1999, by Que Education and Training, Chapter 5, pages of Introduction to Computer Programming with Visual Basic 6: A Problem-Solving Approach.
InvEasy (Project1) Please use speaker notes for additional information!
Break Processing Please use speaker notes for additional information!
08/10/ Iteration Loops For … To … Next. 208/10/2015 Learning Objectives Define a program loop. State when a loop will end. State when the For.
Chapter 4: The Selection Process in Visual Basic.
Programming Examples to Accompany Structure Topic Please use speaker notes for additional information!
Copyright © 2001 by Wiley. All rights reserved. Chapter 4: The Selection Process in Visual Basic Selection Process Two Alternative Structure If..Then..ElseIf.
Array - adding to array at run time Please see speaker notes for additional information!
Programming Test #1 Solutions. Multiple Choice 1. B) the grammar of the coding language 2. C) String 3. A) Single 4. C) 2Burgers4Me 5. B) Design Time.
Do Loop with Interest Please see speaker notes for additional information!
New Project in Visual Basic Please use speaker notes for additional information!
Random Files Please see speaker notes for additional information!
CS285 Visual Basic 2 Department of Computing UniS 1 Statements in Visual Basic A statement is the fundamental syntactical element of a program smallest.
CS0004: Introduction to Programming Project 1 – Lessons Learned.
Exploring Microsoft Access Chapter 8 Creating More Powerful Applications: Introduction to VBA.
Arrays1 From time to time an object (a variable, a picture, a label or a command) does not serve as well as a set of objects of a similar kind addressed.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Class Average Application Introducing the Do...Loop While and Do...Loop Until.
Applications Development
Delivery and other DO Examples Please use speaker notes for additional information!
Practical Programming COMP153-08S Week 5 Lecture 1: Screen Design Subroutines and Functions.
Introduction to ASP.NET Please use speaker notes for additional information!
Two Forms Please use speaker notes for additional information!
1 CS105 Discussion 5 – Variables and If Announcements MP 1 due on Monday Midterm 1 on Tuesday If you need a conflict, request it NOW!!
1 Project 3 The Kumquat Society Conference. 2 Conference Registration In this project you will write a program to handle a conference registration. The.
VAT Calculator program Controls Properties Code Results.
Pay Example (PFirst98) Please use speaker notes for additional information!
Visual Basic I/O Programs (ProjRead1, ProjRead2, ProjWrite1, ProjPay) Please use speaker notes for additional information!
MIS333k(Poynor) Chapter 2. Intro to VBA Events Where to plug in your programs?
31/01/ Selection If selection construct.
110 E-1 Variables, Constants and Calculations(2) Chapter 3: Operations on variables, scope of a variable, formatting data Doing Arithmetic.
2c – Textboxes and Buttons Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming.
Visual Basic Review LBS 126. VB programming Project Form 1Form 2Form 3 Text boxButton Picture box Objects Text box Button Objects.
Tutorial 81 Field, Record, Data File Field - a single item of information about a person, place, or thing Record - a group of related fields that contain.
Using a Database Access97 Please use speaker notes for additional information!
Data and variables in Visual Basic. Annoucement Lecture on Thursday 7:30PM C106 Visual Basic download: 
Murach’s Visual Basic 2008, C7, modified or added© 2008, Mike Murach & Associates, Inc. Slide 1.
Subroutines (PrArith, Math,projCP1, PrAdrProc, PrAdrProcFunc) Please use speaker notes for additional information!
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.
Chapter 6 Controlling Program Flow with Looping Structures.
Visual Basic/ Visual Studio Brandon Large. Connecting to prior knowledge In your notes write down what the two main parts of the computer are. The “software”
Multiple forms - SDI & MDI Please use speaker notes for additional information!
Client-side (JavaScript) Validation. Associating a function with a click event – Part 1 Use the input tag’s onclick attribute to associate a function.
1 By Dr. HANY ELSALAMONY. 1. What are differences between interpreted and compiled languages? 2. What are the programming steps to creating the Visual.
Processing multiple files
Use TryParse to Validate User Input
Visual Basic Fundamental Concepts
Find, filter etc with connection to Access code internally
Use TryParse to Validate User Input
User Forms.
Please use speaker notes for additional information!
Introduction to the Array
CHAPTER FIVE Decision Structures.
Visual Basic..
Tutorial 12 – Security Panel Application Introducing the Select Case Multiple-Selection Statement Outline Test-Driving the Security Panel Application.
Visual Basic: Week 5 Review User defined functions
This shows using the step to increment by other than 1.
If statements (Inven1, Inven2, Inven2a, Inven3, Inven3a)
Language Constructs Construct means to build or put together. Language constructs refers to those parts which make up a high level programming language.
To understand what arrays are and how to use them
Please see speaker notes for additional information!
More on If statements (Calculate, Calculate1, Calculate2)
0,1,2,3,4 pointer of 1,2,3 and 4. This is a wrapup that requires user action. housekeeping.
Presentation transcript:

Department Array in Visual Basic Please use speaker notes for additional information! This shows the department array implemented in Visual Basic.

This shows the output when the user entered a dept code This shows the output when the user entered a dept code. When the user entered 2, WOMENS was retrieved from the array. When the user entered 3, GIRLS was retrieved. Entering 4 got BOYS and entering 1 got MENS.

This shows the form that is used in this program This shows the form that is used in this program. Note that it also shows the properties for the form.

This shows the form and properties for the Dept Code label.

This shows the textbox for the department code This shows the textbox for the department code. It is called txtDeptCode. It also shows the properties associated with this textbox field.

This is the Command Button that will retrieve the name from the array based on the code the user enters. Again, I am showing the properties associated with the Command Button.

This shows the code in the program This shows the code in the program. Note that the code is grouped into Procedures. Some of the procedures are called by Clicking a Button on the form. The procedure Form_Load() is executed when the form is loaded. This procedure fills the array with the department names. These names can then be extracted from the array using the department number that the user inputs.

This defined the DeptName array as containing string data. Dim DeptName(4) As String Option Explicit Private Sub cmdClear_Click() txtDeptCode.Text = "" txtDeptName.Text = "" txtDeptCode.SetFocus End Sub Private Sub cmdExit_Click() End Private Sub cmdGetName_Click() Dim Indx As Integer If Val(txtDeptCode.Text) > 0 And Val(txtDeptCode.Text) < 5 Then Indx = Val(txtDeptCode.Text) txtDeptName.Text = DeptName(Indx) Else txtDeptName.Text = "Invalid Department Code" End If Private Sub Form_Load() DeptName(1) = "MENS" DeptName(2) = "WOMENS" DeptName(3) = "GIRLS" DeptName(4) = "BOYS" This defined the DeptName array as containing string data. The Dim statement defined the index that will hold the txtDeptCode that the user entered. When the txtDeptCode is valid it is put into Index and Index is used to go to the array and take the DeptName and move it to the text box for the name. In this example, the code that is entered is moved to text if it is in the valid range of 1 to 4. Then it is used to index the array name, DeptName to get the correct department from the array. Note that if the code is not valid, an error message is moved to the text box. This shows the data in the array.