Additional Topics in VB.NET

Slides:



Advertisements
Similar presentations
Objectives Understand the software development lifecycle Perform calculations Use decision structures Perform data validation Use logical operators Use.
Advertisements

VB Numbers and Strings School of Business Eastern Illinois University (Week 4, Monday 2/03/2003) © Abdou Illia, Spring 2003.
Microsoft Visual Basic: Reloaded Chapter Six Repeating Program Instructions.
Text Box controls are used when users are required to type some input (during program execution), or output is displayed on the form (known as the user-
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 Validation Check the values entered into a text box before beginning any calculations Validation is a form of ‘self-protection’, rejecting bad data.
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.
 Visual Basic is an object-oriented language used to write application programs that run in Windows or on the Internet using a graphical user interface.
VB DATATYPES, VARIABLES, CONSTANTS & CALCULATIONS.
Chapter 5 new The Do…Loop Statement
Chapter 31 Fundamentals of Programming in Visual Basic (Continue VI) String Properties and Methods: "Visual".Length is 6. "Visual".ToUpper is VISUAL. "123.
1 Chapter 3 – Variables, Input, and Output 3.1 Numbers 3.2 Strings 3.3 Input and Output.
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.
Intrinsic Functions Pre-coded Functions Used to improve developer productivity Broad Range of Activities Math calculations Time/Date functions String.
Enhancing User Interaction Through Programming
Chapter 3 - VB.NET by Schneider1 Chapter 3 – Fundamentals of Programming in VB.NET VB.NET Controls VB.NET Events Numbers Strings Input and Output.
1 Chapter 3 – Variables, Input, and Output 3.1 Numbers 3.2 Strings 3.3 Input and Output.
For Loops (ProjFor1, ProjFor2, ProjFor3, ProjFor4, textbox, textbox1) Please use speaker notes for additional information!
Chapter 9 - VB.Net by Schneider1 Chapter 9 – Additional Controls and Objects 9.1 List Boxes, Combo Boxes, and the File-Opening Control The List Box Control.
Fundamentals of GUI Programming. Objectives: At the end of the session, you should be able to: describe the guidelines that are used for creating user-friendly.
Numbers continued The Integer Data Type Multiple Declarations Parentheses Three Types of Errors.
Slide 1 Using Menu Bar & Common Dialog Boxes. Slide 2 Setting Up the Main Items v First open the form on which you want the menu located v Then start.
Pay Example (PFirst98) Please use speaker notes for additional information!
Chapter 6 Looping Structures. Do…LoopDo…Loop Statement Can operate statements repetitively Do intx=intx + 1 Loop While intx < 10 –The Loop While operates.
Tutorial 3: Using Variables and Constants1 Tutorial 3 Using Variables and Constants.
Chapter 4 Getting Started with VBA. Subroutines Subroutine is the logical section of code that performs a particular task. Subroutine is also called a.
CS4 –lecture 6 Wednesday, Jan 19, 2011 Roxana Gheorghiu.
Controlling Program Flow with Looping Structures
Introduction to Programming
Variables and Expressions Programming Right from the Start with Visual Basic.NET 1/e 7.
Visual Basic.NET Programming for the Rest of Us Keith Mulbery Utah Valley State College.
Introduction to Programming Python Lab 7: if Statement 19 February PythonLab7 lecture slides.ppt Ping Brennan
Chapter 3 - VB 2008 by Schneider1 Chapter 3 – Variables, Input, and Output 3.1 Numbers 3.2 Strings 3.3 Input and Output.
Chapter 6 Controlling Program Flow with Looping Structures.
© 2010 Lawrenceville Press Slide 1 Chapter 5 The Do…Loop Statement  Loop structure that executes a set of statements as long as a condition is true. 
Introduction to Programming
Visual Basic Fundamental Concepts
PictureBox, MessageBox, Multiple Forms, Splash Screens and Timers
Excel Tutorial 8 Developing an Excel Application
14 Shipping Time App Using Dates and Timers
IE 8580 Module 4: DIY Monte Carlo Simulation
A variable is a name for a value stored in memory.
Topics Graphical User Interfaces Using the tkinter Module
Project 9 Creating Pop-up Windows, Adding Scrolling Messages, and Validating Forms.
Introduction to Programming
Introduction to Scripting
Variables and Arithmetic Operations
Visual Basic..
Tutorial 12 – Security Panel Application Introducing the Select Case Multiple-Selection Statement Outline Test-Driving the Security Panel Application.
Introduction to Programming
Tutorial 19 - Microwave Oven Application Building Your Own Classes and Objects Outline Test-Driving the Microwave Oven Application Designing.
Chapter 9 – Additional Controls and Objects
WEB PROGRAMMING JavaScript.
Fundamentals of Programming in VB.NET
Numbers.
T. Jumana Abu Shmais – AOU - Riyadh
Section 3.3 Numbers Arithmetic Operations Variables
Variable Review & IO User 12/26/2018.
Chapter 3.5 Input and Output
Introduction to Programming
CIS 16 Application Development Programming with Visual Basic
VB.NET PROGRAMMING FINAL EXAM TEST REVIEW.
Input and Output.
Topics Graphical User Interfaces Using the tkinter Module
JavaScript.
Introduction to Programming
JavaScript: Introduction to Scripting
Input and Output.
Introduction to Programming
Input and Output Chapter 3.5
Presentation transcript:

Additional Topics in VB.NET Lecture 9 Additional Topics in VB.NET

Timer Control Invisible during runtime Triggers an event after a specified period of time The Interval property specifies the time period – measured in milliseconds To begin timing, set the Enabled property to True To stop timing, set the Enabled property to False The event triggered each time is called Tick event

Timer Control (cont.) Interval property Enabled property Tick event Between 0 and 65,535 milliseconds 1,000 milliseconds = 1 second Enabled property False (default) ==> Do not run Tick event True ==> Run Tick event at designated interval Tick event Runs each time the Timer's designated interval elapses, if Enabled = True

DateTimePicker & Calendar Controls Takes less screen space Displays only day and date unless user drops down the calendar MonthCalendar Displays calendar Provide the ability to display calendars on your form

Calendar Controls (cont.) DateTimePicker MonthCalendar

Getting Input from an Input Dialog Box stringVar = InputBox(prompt, title) fileName = InputBox("Enter the name " _ & "of the file containing the " & _ "information.", "Name of File")

Using a Message Dialog Box for Output Displays a message in a dialog box, waits for the user to click a button MsgBox(prompt) MsgBox("Nice try, but no cigar") MsgBox(prompt, , title) is executed, where prompt and title are strings, a message dialog box appears with prompt displayed and the title bar caption title and stays on the screen until the user presses Enter, clicks on the box in the upper-right corner, or clicks OK. For instance, the state-ment MsgBox("Nice try, but no cigar.", , "Consolation")

Some Built-In Functions Example Input Output Int Int(2.6) is 2 number Chr Chr(65) is “A” string Asc Asc(“Apple”) is 65 Math.Round Math.Round(2.7) is 3 Math.Sqrt Math.Sqrt(9) is 3 Number number

Built-in Functions (2) Functions return a value IsNumeric(9) ' Returns True IsNumeric(459.95) ' Returns True IsNumeric(“45 help”) ' Returns False

Input Validation Code If structure to determine if value falls within a range of acceptable values Refer to lab 6 – Calculate Grade Use single If for each value, Else for message to user, and execute Focus Method to reset focus to text box

Input Validation (2) Check to see if valid values were entered by user in TextBox and use Message Box to notify user if invalid IsNumeric function checks for numeric values If IsNumeric(txtQuantity.Text) Then ... Check for required data or not blank If txtName.Text <> "" Then ...

Variables Declaration: Assignment: Dim speed As Double speed = 50 Data type Variable name Assignment: speed = 50

Initial Value of a Integer An integer is a whole number Declaring an integer variable: Dim varName As Integer (Numeric variables are automatically initialized to 0) To specify a nonzero initial value Dim varName As Double = 50

Initial Value of a String By default the initial value is Nothing Strings can be given a different initial value as follows: Dim today As String = "Monday"

Incrementing To add 1 to the numeric variable var Or as a shortcut var = var + 1 Or as a shortcut var +=1

Multiple Declarations Dim a As Integer Dim b As Integer Alternative method: Multiple-declaration Dim a, b As Integer

' Display the Hello World message Remark Statement Also known as Comment, used for documentation Non-executable Automatically colored Green in Editor Begins with an apostrophe ( ' ) On a separate line from executable code At the right end of a line of executable code ' Display the Hello World message

lblMessage.Text=" Hello World " Assignment Statement Assigns a value to a property or variable Operates from right to left Enclose text strings in quotation marks (" ") lblMessage.Text=" Hello World "