Fun with VB - PowerPoint PPT Presentation

1 / 17
About This Presentation
Title:

Fun with VB

Description:

Sounds. Multiple Windows/Forms. Resources. These are the part of the ... Under project properties. Executable Code. As a user have you had to edit code? ... – PowerPoint PPT presentation

Number of Views:40
Avg rating:3.0/5.0
Slides: 18
Provided by: mil94
Category:
Tags: fun

less

Transcript and Presenter's Notes

Title: Fun with VB


1
Fun with VB
  • CS0004
  • Lecture 13

2
Administration
  • Project 2 due today
  • What does by midnight mean?
  • Mid-term next week
  • Review sheet is online
  • Sample questions for exam
  • Review next Monday
  • Come to class with questions
  • Review on Sunday?

3
Review
  • Variables
  • Data Types
  • String, Integer, Double, Array
  • If Blocks
  • Select Case
  • Loops
  • Do While, Do Until, For Next
  • Procedures and Functions

4
Whats missing?
  • Fun!

Images
Sounds
Multiple Windows/Forms
5
Resources
  • These are the part of the application that isnt
    code
  • Images
  • Sounds
  • Files
  • Icons

6
Resources
  • This prevents you from having filespecs embedded
    in your code
  • If userWins True Then
  • img.Image C\my_winner.jpg
  • End If
  • It does so by abstracting the file using a name,
    just like an object
  • If userWins True Then
  • img.Image My.Resources.WinnerImage
  • End If

7
Resources
  • Advantages
  • Not computer dependent
  • When you build your project the files are
    embedded
  • Much easier to make changes later
  • Use the resource manager to
  • Import Resources
  • Change Resources
  • Delete Resources

8
Resources
  • Example

9
Other Uses of Resources
  • Strings?
  • Application name changes
  • Company name changes
  • Internationalization
  • Use resources instead of strings
  • Just replace resource files

10
What is a Window?
  • A window is the same as a form
  • A form is just like all the other objects we have
    dealt with
  • Windows have properties
  • name, visible, enable
  • Windows have events
  • Load
  • This event is triggered when the form loads

11
Pausing Execution
  • We need the program to sleep
  • There is this complex notion in computers called
    threads
  • You can think of each thread as a single process
  • System.Threading.Thread.Sleep(2000)
  • This tells the computer to sleep (ie pause) for
    2000 milliseconds (2 seconds)
  • This stops all events from firing for the
    allotted time

12
Splash Screens
  • These are the screens that appear while the
    program is loading

13
Splash Screens
  • Use a combination of sleeping and multiple
    windows to create a splash screen
  • Can use resources to display images
  • To make splash screen display at the beginning
    need to change Startup Form
  • Under project properties

14
Executable Code
  • As a user have you had to edit code?
  • You are all computer users and yet most of you
    never saw a line of code until this class
  • How is this even possible?
  • The code that actually runs on your computer is
    referred to as executable code
  • Not human readable

15
Executable Code
  • The code you write in visual basic gets converted
    into executable code the computer can understand
  • Called Compiling
  • Once the code is compiled it can then be ran by
    the computer and therefore the user never sees
    the code

16
Executable Code
  • What if you want to send your friend your
    blackjack application
  • Would your friend need Visual Basic installed?
  • Of course not, this would be a real pain
  • You would just send them the compiled code
  • This file will have .exe extension
  • Every time you run your program a new .exe file
    is generated under the bin directory of your
    project
  • Send your friend this .exe file

17
Coming Attractions
  • Multi-Dimensional Arrays
  • Like rows and columns
  • Sorting Arrays
  • Various Algorithms
  • File Open dialog
  • Drawing Graphics
  • Pie charts, bar charts
  • Using the internet (Web Services)
  • How to get information from the internet and use
    it
  • VB in excel, word, etc.
Write a Comment
User Comments (0)
About PowerShow.com