PictureBox, MessageBox, Multiple Forms, Splash Screens and Timers

Slides:



Advertisements
Similar presentations
Multiple Forms, Standard Modules, And Menus
Advertisements

Chapter 1: An Introduction to Visual Basic 2012
© by Pearson Education, Inc. All Rights Reserved. continued …
Chapter 6 Multiform Projects Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
Chapter 1: An Introduction to Visual Basic.NET Programming with Microsoft Visual Basic.NET, Second Edition.
Addison Wesley is an imprint of © 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Chapter 7 Multiple Forms, Modules,
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 7- 1.
1 Introduction to the Visual Studio.NET IDE Powerpoint slides modified from Deitel & Deitel.
PictureBox, Timer, Resources. Resources An easy and effective way to add pictures (photos, graphics) to your programs Using Resources guarantees that.
Copyright © 2014 Pearson Education, Inc. Chapter 7 Multiple Forms, Modules, and Menus.
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter One An Introduction to Visual Basic 2010.
Microsoft Visual Basic 2005 CHAPTER 8 Using Procedures and Exception Handling.
Programming with Microsoft Visual Basic 2008 Fourth Edition Chapter Seven Sub and Function Procedures.
Microsoft Visual Basic 2012 Using Procedures and Exception Handling CHAPTER SEVEN.
Microsoft Visual Basic 2008 CHAPTER 8 Using Procedures and Exception Handling.
Multiple Forms, Standard Modules, And Menus
Multiple Forms and Standard Modules
IE 411/511: Visual Programming for Industrial Applications
Chapter 1: An Introduction to Visual Basic 2005 Programming with Microsoft Visual Basic 2005, Third Edition.
Multiple Forms, Container Controls, AddHandler This presentation is based on the Forms and ContainerControls VB Projects 1.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 4 I Need a Tour Guide.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 7 Using Menus, Common Dialogs, Procedures, Functions, and Arrays.
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.
 Application – another name for a program.  Interface – is what appears on the screen when the application is running.  Program Code – is instructions.
Chapter One An Introduction to Visual Basic 2010 Programming with Microsoft Visual Basic th Edition.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved. 1 3 Welcome Application Introduction to Visual Programming.
The PictureBox Control Prefix Prefix – pic Image Property PictureBox Image Property – Changes the image or file that appears inside of the PictureBox SizeMode.
McGraw-Hill © 2009 The McGraw-Hill Companies, Inc. All rights reserved. Chapter 6 Multiform Projects.
Chapter Two Creating a First Project in Visual Basic.
Chapter 2 – Introduction to the Visual Studio .NET IDE
Slide 1 VB Graphics Controls & Timer Control. Slide 2 Default Controls.
Microsoft Visual Basic 2008: Reloaded Third Edition Chapter One An Introduction to Visual Basic 2008.
6-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Chapter 2 Introduction to Visual Basic Programming Visual Basic.NET.
Addison Wesley is an imprint of © 2011 Pearson Addison-Wesley. All rights reserved. Chapter 2 Creating Applications with Visual Basic.
1 Windows Forms II Chapter RadioButton / GroupBox Controls Used to solicit a multiple choice input. Radio buttons work as a group. Selecting one.
Visual Basic.NET Programming for the Rest of Us Keith Mulbery Utah Valley State College.
Creating New Forms Projects can appear more professional when using different windows for different types of information. Select Add Windows Form from.
IE 411/511: Visual Programming for Industrial Applications Lecture Notes #2 Introduction to the Visual Basic Express 2010 Integrated Development Environment.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
 You won’t write a single line of program code.  Instead, you’ll use visual programming techniques.  Visual Studio processes your actions (such as mouse.
2-1 Chapter 2 Using VB.NET to Create a First Solution.
Programming with Microsoft Visual Basic 2012 Chapter 1: An Introduction to Visual Basic 2012.
Programming with Microsoft Visual Basic 2008 Fourth Edition Chapter One An Introduction to Visual Basic 2008.
Chapter 8 Multiple Forms, Modules, and Menus. Introduction This chapter demonstrates how to: – Add multiple forms to a project – Create a module to hold.
Chapter 7, Slide 1Starting Out with Visual Basic 3 rd Edition Chapter 7 Multiple Forms, Standard Modules, And Menus.
Chapter 1: An Introduction to Visual Basic .NET
Chapter 1: An Introduction to Visual Basic 2015
Apply Procedures to Develop Message, Input, and Dialog Boxes
Chapter 2 – Introduction to the Visual Studio .NET IDE
3.01 Apply Controls Associated With Visual Studio Form
Files.
Objective 8.02 Apply Procedures to Create Picture Boxes using Images.
3.01 Apply Controls Associated With Visual Studio Form
Chapter 1: An Introduction to Visual Basic 2015
Introduction to the Visual C# 2005 Express Edition IDE
Programming with Microsoft Visual Basic th Edition
Word and the Writing Process
Programming with Microsoft Visual Basic th Edition
Using Procedures and Exception Handling
Creating Applications with Visual Basic
Chapter 6 Multiform Projects
Multiple Forms, Modules, and Menus
Lecture Set 11 Creating and Using Classes
Multi-Form Applications Things You Need to Know
Visual Studio.
Additional Topics in VB.NET
Visual C# - GUI and controls - 1
Presentation transcript:

PictureBox, MessageBox, Multiple Forms, Splash Screens and Timers Chapter 2 pp. 52-53 Chapter 4 pp. 224-225 Chapter 7 pp. 401-408 Chapter 8 pp. 511-515 Chapter 2

Chapter 2 PictureBox Control Chapter 2

PictureBox Control Download these bmp files from the ftp site: Oklahoma.bmp Utah.bmp Insert PictureBox controls and name them: picOklahoma picUtah Adjust SizeMode. Chapter 2

Picture Box SixeMode Values AutoSize Adjusts automatically to fit size of image it displays. CenterImage Centers image within control size when bounding box is > than the image. Displays center portion of image and cropped to fit if box is < than image. Normal Aligns image with upper left corner of control box; clips image if image is larger than box size. StretchImage Scales image to fit within control box. Stretches smaller image or shrinks larger image. Chapter 2

Chapter 2

Chapter 4 MessageBox Method Chapter 2

MessageBox Dialog box that displays a message to the user. Types of messages: Information (Your data has been added) Warnings (Do you want to save?) Critical (System Error) Question (Need input from user) Chapter 2

MessageBox.Show Method MessageBox.Show("Message") Message box with OK button; no title Chapter 2

MessageBox("Message","Caption") Comma separates arguments. Quotes surround string literals. Underscore provides line continuation. Caption appears on title bar. Chapter 2

MessageBox("Message","Caption",Buttons) MessageBoxButtons.AbortRetryIgnore MessageBoxButtons.OK MessageBoxButtons.OKCancel MessageBoxButtons.RetryCancel MessageBoxButtons.YesNo MessageBoxButtons.YesNoCancel Will program later when we can control action of buttons. Chapter 2

MessageBox.Show("Message","Caption",Buttons,Icon) MessageBoxIcon.Information MessageBoxIcon.Asterisk MessageBoxIcon.Error MessageBoxIcon.Stop MessageBoxIcon.Warning MessageBoxIcon.Exclamation MessageBoxIcon.Question Chapter 2

MessageBox Example Chapter 2

Which button clicked? Will cover later after learning about variables. Stay tuned… Chapter 2

Multiple Lines: ControlChars.CrLf Displays multiple lines within a message box. ControlChars.CrLf Carriage return/line feed Begin a new line Example MessageBox.Show("This is line 1" & _ ("This is line 2") Chapter 2

Chapter 7 Multiple Forms Chapter 2

Form Names and File Names Default Name Property: Form1 Default File Name: Form1.vb Should assign descriptive form names for multiple-form programs Need to do more than change Name property: Also change file name Also change Startup Object Chapter 2

Default File Name and Name Chapter 2

Changed File Name and Name Must keep .vb filename extension. Chapter 2

Startup Object (p. 405) Right-click Project name (in Solution Explorer window) and choose Properties. …or… Choose Project, Properties. Chapter 2

Startup Object Click Startup object drop-down arrow and choose form name to be first object (form) that appears. Chapter 2

Add Form Click Add New Item on toolbar. Keep the .vb extension Chapter 2

Switching Between Forms Active Form Code window for frmStates form frmstates form Chapter 2

Instance of Form 1st step to display form: create an instance. Dim ObjectVariable As New ClassName() ObjectVariable Name that refers to instance of form, sort of like an alias (not name of form itself though) Holds memory address of object (form) so that you can use it ClassName() Form’s class name—the name used in the Name property for a form Chapter 2

Example Dim errorForm As New frmError() errorForm is object variable name that creates instance of actual form frmError is the name of the actual form Does not actually display form Chapter 2

ShowDialog Method Modal method ObjectVariable.ShowDialog() No other form can receive focus until the modal form is closed. Forces user (or timer) to acknowledge active form ObjectVariable.ShowDialog() errorForm.ShowDialog() Chapter 2

Show Method Modeless form ObjectVariable.Show() errorForm.Show() Allows user to switch focus to another form while the modeless form is displayed ObjectVariable.Show() errorForm.Show() Chapter 2

Close Method Closes a form and releases it from memory. Me.Close() Me—current instance of the form Close—closes current instance Use to close a form in a multiple-form program without terminating the application Chapter 2

Hide Method Removes form from the screen. Keeps form in memory; does not release it. Acts like changing form’s Visible property to False. Chapter 2

Splash Screens & Timer Control Chapter 8 Splash Screens & Timer Control Chapter 2

Splash Screen (p. 513) Form displayed while a program loads. Typical content: Logo Copyright Date (©2004) Program Name (e.g., Microsoft Word) Program Version (e.g., 2003) Disappears after short time TopMost Property: True Displays on top of other forms Chapter 2

Timer Control (p. 511) Enables a program to automatically execute code at regular time intervals. Examples: Perform animation Unload a form (such as a splash screen) after a time delay Conventional prefix tmr tmrSplashScreen Responds to Tick events Chapter 2

Timer Properties Interval Property Enabled Property Set to value of 1 or greater Each 1 = 1 millisecond (thousandth of a second); 1,000 milliseconds = 1 second Error if set to 0 Enabled Property Set to True Chapter 2

Hide Splash Screen (p. 515 Step 7) Me.Close () closes the current form Chapter 2

Main Form (p. 515 Step 9) Set as the Startup Object. Create object variable in Form Load. Use variable to show other form. Form variable declared Actual name of form Name of actual form Form variable used to show actual form Chapter 2