SlideShare a Scribd company logo
1 of 31
Chapter One:
Event Drive Fundamentals:
1.1 What’s an event driven program?
1.2 Working in the Programming Environment
1.3 Building Your First Application
1.4 Using the intrinsic/basic/ controls
1.5 Working with Properties, Methods, and Events
1.6 Working with Projects in event driven Programming
UOG, IS Department Ins. G/M 1
2
1.1 What’s an event driven
program?
What are Events?
• An event can be defined as a type of signal
to the program that something has
happened.
• The event is generated by external user
actions such as mouse movements, mouse
clicks, and keystrokes, or by the operating
system, such as a timer.
What’s an event driven program?
Visual Basic falls into a category of programming
referred to as event-driven programming.
 Event-driven programs respond to events from
the computer, such as the mouse button being
pressed.
The designer uses ready-made objects such as
Command Buttons and Textboxes, to build user
interfaces that make up the application.
This approach to programming drastically reduces
the amount of code required to develop a Windows
application.
UOG, IS Department Ins. G/M 3
…
Visual Basic is event-driven, meaning code
remains idle until called upon to respond to some
event (button pressing, menu selection ...).
Visual Basic is governed by an event processor.
Nothing happens until an event is detected. Once
an event is detected, the code corresponding to
that event (event procedure) is executed.
Program control is then returned to the event
processor.
UOG, IS Department Ins. G/M 4
1.2. Working in the Programming Environment
Default Environment Settings
The full version of Visual Studio 2010 provides an
option to allow the programmer to select the
default profile for the IDE. The first time you open
VisualStudio, you are presented with the Choose
Default Environment Settings dialogbox, where
you can chooseVisual Basic Development Settings.
Notice the instructions in the dialog box: you can
make a different selection later from theTools
menu.
Note: If you are using the Express version of
Visual Basic, you won’t see this dialog box.
UOG, IS Department Ins. G/M 5
UOG, IS Department Ins. G/M 6
The New Project Dialog
UOG, IS Department Ins. G/M 7
UOG, IS Department Ins. G/M 8
…
Title Bar: The top line is called the Title bar, it
includes the project name and icons to minimize,
maximize and close the project
Menu Bar: The second line is called the Menu bar.
Selecting one of the choices (File, Edit, View,
Project, Format… Help) causes one of drop-down
menus to appear. The user can select required
menu.
Tool bar: The third line is called the Standard Tool
bar. The icons on this line duplicate several of the
more commonly used menu items. It acts as a
short cut to select the menu
UOG, IS Department Ins. G/M 9
…
Form design and project container windows: The
Form design window is where the user interface
is actually designed by placing the controls from
Tool Box. Each control can be moved, resized and
its properties can be assigned using Properties
Window.
Tool box: The Toolbox contains commonly used
controls. A control can be selected and placed in
the Form by double clicking on the control or by
clicking once on the control, then clicking on the
desired location within the form. The associated
code can be viewed or edited by double clicking
on the control
UOG, IS Department Ins. G/M 10
…
Properties window: Each Object has its own unique list
of properties. The Properties Window allows assigning
or changing the properties.
Project window: The Project Window displays a
hierarchical list of the files associated with a given
project.
Form layout window: This window specifies the screen
location of the forms within a project, the location can
be changed by dragging the form icon to the desired
position
Immediate window: This window is very useful for
debugging a project. Whenever a variable or
expression is entered, the corresponding value will be
shown immediately
UOG, IS Department Ins. G/M 11
1.3 Building Your First Application
Developing VB projects
To develop VB projects, the three steps process for
planning the project and then repeat the process for
creating the project is to be done.
Planning
Design the User Interface: Draw the forms and controls
with the names
Plan the Properties: Specify the properties of all controls
to set or change during the design of the form
Plan the basic code: Plan the procedures to be executed
when the project runs. Write the pseudo code, which
is an English expression or comment the part that
describes the action.
UOG, IS Department Ins. G/M 12
…
Programming፡
Define the User Interface : Create the forms
and controls designed in the planning stage
Set the Properties : Define the properties of the
controls
Write the Visual Basic code : Write VB
programming statements to carry out the
actions needed.
UOG, IS Department Ins. G/M 13
Object’s Properties Can Be Set In Two Ways
1. Setting Properties of Objects at Design Time
Properties can be changed by typing a new
value or choosing from a list of predefined
settings (available as a drop down list) in
Properties Window. A very important property
for each object is its name. The name is used
by Visual Basic to refer to a particular object in
code.
UOG, IS Department Ins. G/M 14
…
2. Setting Properties at Run Time:
You can also set or modify properties while your
application is running. To do this, you must
write some code. The code format is:
ObjectName.Property = NewValue
Such a format is referred to as dot notation. For
example, to change the BackColor property of
a form name frmStart, we'd type:
frmStart.BackColor = BLUE
UOG, IS Department Ins. G/M 15
1.4 Using the intrinsic controls
There are about 20 controls which are built in
to VB. These controls are called intrinsic
controls. Every one of the intrinsic controls are
available to every VB program you write.
When you create a "New" VB project, all 20 of
the intrinsic controls will show up in Toolbox.
This is true for all versions of VB.
UOG, IS Department Ins. G/M 16
The Most Useful Intrinsic Controls
These intrinsic controls are pretty much used on
every VB application. Start your learning with
these and then branch out.
each of the controls:
 CommandButton
 ImageBox
 Option Button
 CheckBox
 PictureBox
 TextBox
 ListBox
 Label
 ComboListBox
UOG, IS Department Ins. G/M 17
1.5. Working with Properties, Methods,
and Events
Properties
Objects are described with "properties" (data)
which tell you
what they look like, where they go, how they
will act, and what they contain.
Properties often describe physical properties
of the object (color or size), but they can also
describe behavior, and the data contained by
an object.
UOG, IS Department Ins. G/M 18
…
Examples of properties include:
Appearance___color
Behavior__dragging,visibility
Position___top,left.width,height
Content___text,graphics
Font__name,size,bold,italic
Value__data stored by the object
The following example shows the property list
for the "lastname" text box...
UOG, IS Department Ins. G/M 19
…
UOG, IS Department Ins. G/M 20
…
Methods
Objects usually have many things that they can
do or that can be done to them. These are
predefined procedures that often modify
properties of the object such as its location.
For example:
Move—change the location of an object
Drag–allow it to be dragged with by the mouse
Paint—display or redisplay the object
Draw (Point, Line)—use the object to draw (e.g.,
use a mouse) or draw with the object (e.g., a
picture object)
UOG, IS Department Ins. G/M 21
…
In the following example, the text1.move will
cause the text box to move and be resized
when the button is clicked
UOG, IS Department Ins. G/M 22
…
In many cases, values are passed to methods
that change property values.
For example, the "move" method in Visual
Basic is given values for the left and top
position as well as height and width. The
properties for left, top, width, and height are
changed by the "move" method.
UOG, IS Department Ins. G/M 23
…
Events
The secret to how most windows-based programs
lies in behaviors called "events". Events are
triggered when windows are "loaded," buttons
are "clicked," or text boxes are "changed." These
events drive the program. Objects can respond to
stimuli or things that are done to them. For
example: Click, Double Click, Mouse Down,
Over, Up, drag change
The following example from Visual Basic shows the
event list for the push button...
UOG, IS Department Ins. G/M 24
…
UOG, IS Department Ins. G/M 25
…
In many programming systems such as Visual
Basic and JavaScript, objects are associated
with behavior by appending a descriptive
behavioral term to the name of the object.
For example: "gobutton_click" indicating that
the button has been clicked. In some cases,
certain events such as "onclick" are explicitly
associated with the object, a button.
UOG, IS Department Ins. G/M 26
From a programming perspective, events are where the work is
done. Code is attached to events to drive a program. For
example:
Sub command1_click ()
Text1.text = "Hello World"
End Sub
In this example:
There are, at least, 2 objects (button and text box) and the
window.
The event is triggered when the user clicks the button,
Clicking the button (an event) triggers the command1_click
subroutine,
Which contains code for updating the text box.
Code written for events may be used to call other procedures,
change properties, or invoke methods.
UOG, IS Department Ins. G/M 27
1.6.Working with Projects in event driven
Programming
Opening, saving and running VB projects
An existing project can be opened through the New project
window by selecting the project name listed under the
Existing or the Recent tab. Once the project is opened,
the form may not be visible; the desired form can be
opened using the Project window.
To save a new VB project for the first time, choose Save
Project As from the File menu. To save an updated
version of a previously saved project, click on the Save
Project from the File menu or Tool bar.
The VB project can be executed by clicking the Start Button
in the Tool bar or select Start from the Run menu. The
execution can be temporarily suspended by clicking on
the Break button or Break from Run menu.
UOG, IS Department Ins. G/M 28
29
NB. Discus the following in group
Procedural vs. Event-Driven Programming
• Procedural programming is executed in
procedural order.
• In event-driven programming, code is executed
upon activation of events.
30
“Hello World!”
of Event-Driven Programming
• The example displays a button in the frame. A
message is displayed on the console when a
button is clicked.
HandleEvent
Run
The End
UOG, IS Department Ins. G/M 31

More Related Content

What's hot (20)

Chain of responsibility
Chain of responsibilityChain of responsibility
Chain of responsibility
 
Java: GUI
Java: GUIJava: GUI
Java: GUI
 
Android activity lifecycle
Android activity lifecycleAndroid activity lifecycle
Android activity lifecycle
 
JAVA PROGRAMMING- GUI Programming with Swing - The Swing Buttons
JAVA PROGRAMMING- GUI Programming with Swing - The Swing ButtonsJAVA PROGRAMMING- GUI Programming with Swing - The Swing Buttons
JAVA PROGRAMMING- GUI Programming with Swing - The Swing Buttons
 
Network programming
Network programmingNetwork programming
Network programming
 
visual basic programming
visual basic programmingvisual basic programming
visual basic programming
 
Presentation on Visual Studio
Presentation on Visual StudioPresentation on Visual Studio
Presentation on Visual Studio
 
Struts
StrutsStruts
Struts
 
JAVA AWT
JAVA AWTJAVA AWT
JAVA AWT
 
Java Design Patterns Tutorial | Edureka
Java Design Patterns Tutorial | EdurekaJava Design Patterns Tutorial | Edureka
Java Design Patterns Tutorial | Edureka
 
C# Delegates and Event Handling
C# Delegates and Event HandlingC# Delegates and Event Handling
C# Delegates and Event Handling
 
RichControl in Asp.net
RichControl in Asp.netRichControl in Asp.net
RichControl in Asp.net
 
Software re engineering
Software re engineeringSoftware re engineering
Software re engineering
 
Server Controls of ASP.Net
Server Controls of ASP.NetServer Controls of ASP.Net
Server Controls of ASP.Net
 
Java features
Java featuresJava features
Java features
 
Php Presentation
Php PresentationPhp Presentation
Php Presentation
 
Activity diagram
Activity diagramActivity diagram
Activity diagram
 
3 Tier Architecture
3 Tier Architecture3 Tier Architecture
3 Tier Architecture
 
Pressman ch-3-prescriptive-process-models
Pressman ch-3-prescriptive-process-modelsPressman ch-3-prescriptive-process-models
Pressman ch-3-prescriptive-process-models
 
Web controls
Web controlsWeb controls
Web controls
 

Similar to Chapter 1

06 win forms
06 win forms06 win forms
06 win formsmrjw
 
Software engineering modeling lab lectures
Software engineering modeling lab lecturesSoftware engineering modeling lab lectures
Software engineering modeling lab lecturesmarwaeng
 
Vb ch 3-object-oriented_fundamentals_in_vb.net
Vb ch 3-object-oriented_fundamentals_in_vb.netVb ch 3-object-oriented_fundamentals_in_vb.net
Vb ch 3-object-oriented_fundamentals_in_vb.netbantamlak dejene
 
VB6_INTRODUCTION.ppt
VB6_INTRODUCTION.pptVB6_INTRODUCTION.ppt
VB6_INTRODUCTION.pptBhuvanaR13
 
vb-160518151614.pdf
vb-160518151614.pdfvb-160518151614.pdf
vb-160518151614.pdfLimEchYrr
 
vb-160518151614.pptx
vb-160518151614.pptxvb-160518151614.pptx
vb-160518151614.pptxLimEchYrr
 
object oriented fundamentals in vb.net
object oriented fundamentals in vb.netobject oriented fundamentals in vb.net
object oriented fundamentals in vb.netbantamlak dejene
 
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptxhjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptxEliasPetros
 
Visual programming basic.ppt bs cs5th class
Visual programming basic.ppt bs cs5th classVisual programming basic.ppt bs cs5th class
Visual programming basic.ppt bs cs5th classmnewg218
 
Visual basic concepts
Visual basic conceptsVisual basic concepts
Visual basic conceptsmelody77776
 
visual basic v6 introduction
visual basic v6 introductionvisual basic v6 introduction
visual basic v6 introductionbloodyedge03
 

Similar to Chapter 1 (20)

Meaning Of VB
Meaning Of VBMeaning Of VB
Meaning Of VB
 
Vb6.0 intro
Vb6.0 introVb6.0 intro
Vb6.0 intro
 
06 win forms
06 win forms06 win forms
06 win forms
 
Software engineering modeling lab lectures
Software engineering modeling lab lecturesSoftware engineering modeling lab lectures
Software engineering modeling lab lectures
 
Vb introduction.
Vb introduction.Vb introduction.
Vb introduction.
 
Vb ch 3-object-oriented_fundamentals_in_vb.net
Vb ch 3-object-oriented_fundamentals_in_vb.netVb ch 3-object-oriented_fundamentals_in_vb.net
Vb ch 3-object-oriented_fundamentals_in_vb.net
 
Visual basic
Visual basicVisual basic
Visual basic
 
VB6_INTRODUCTION.ppt
VB6_INTRODUCTION.pptVB6_INTRODUCTION.ppt
VB6_INTRODUCTION.ppt
 
vb.pptx
vb.pptxvb.pptx
vb.pptx
 
vb-160518151614.pdf
vb-160518151614.pdfvb-160518151614.pdf
vb-160518151614.pdf
 
vb-160518151614.pptx
vb-160518151614.pptxvb-160518151614.pptx
vb-160518151614.pptx
 
Vb lecture
Vb lectureVb lecture
Vb lecture
 
object oriented fundamentals in vb.net
object oriented fundamentals in vb.netobject oriented fundamentals in vb.net
object oriented fundamentals in vb.net
 
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptxhjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
hjksjdhksjhcksjhckjhskdjhcskjhckjdppt.pptx
 
Visual Programming
Visual ProgrammingVisual Programming
Visual Programming
 
Ch02 bronson
Ch02 bronsonCh02 bronson
Ch02 bronson
 
Visual programming basic.ppt bs cs5th class
Visual programming basic.ppt bs cs5th classVisual programming basic.ppt bs cs5th class
Visual programming basic.ppt bs cs5th class
 
Visual basic concepts
Visual basic conceptsVisual basic concepts
Visual basic concepts
 
visual basic v6 introduction
visual basic v6 introductionvisual basic v6 introduction
visual basic v6 introduction
 
Vb 6ch123
Vb 6ch123Vb 6ch123
Vb 6ch123
 

Recently uploaded

"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 

Recently uploaded (20)

"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 

Chapter 1

  • 1. Chapter One: Event Drive Fundamentals: 1.1 What’s an event driven program? 1.2 Working in the Programming Environment 1.3 Building Your First Application 1.4 Using the intrinsic/basic/ controls 1.5 Working with Properties, Methods, and Events 1.6 Working with Projects in event driven Programming UOG, IS Department Ins. G/M 1
  • 2. 2 1.1 What’s an event driven program? What are Events? • An event can be defined as a type of signal to the program that something has happened. • The event is generated by external user actions such as mouse movements, mouse clicks, and keystrokes, or by the operating system, such as a timer.
  • 3. What’s an event driven program? Visual Basic falls into a category of programming referred to as event-driven programming.  Event-driven programs respond to events from the computer, such as the mouse button being pressed. The designer uses ready-made objects such as Command Buttons and Textboxes, to build user interfaces that make up the application. This approach to programming drastically reduces the amount of code required to develop a Windows application. UOG, IS Department Ins. G/M 3
  • 4. … Visual Basic is event-driven, meaning code remains idle until called upon to respond to some event (button pressing, menu selection ...). Visual Basic is governed by an event processor. Nothing happens until an event is detected. Once an event is detected, the code corresponding to that event (event procedure) is executed. Program control is then returned to the event processor. UOG, IS Department Ins. G/M 4
  • 5. 1.2. Working in the Programming Environment Default Environment Settings The full version of Visual Studio 2010 provides an option to allow the programmer to select the default profile for the IDE. The first time you open VisualStudio, you are presented with the Choose Default Environment Settings dialogbox, where you can chooseVisual Basic Development Settings. Notice the instructions in the dialog box: you can make a different selection later from theTools menu. Note: If you are using the Express version of Visual Basic, you won’t see this dialog box. UOG, IS Department Ins. G/M 5
  • 6. UOG, IS Department Ins. G/M 6
  • 7. The New Project Dialog UOG, IS Department Ins. G/M 7
  • 8. UOG, IS Department Ins. G/M 8
  • 9. … Title Bar: The top line is called the Title bar, it includes the project name and icons to minimize, maximize and close the project Menu Bar: The second line is called the Menu bar. Selecting one of the choices (File, Edit, View, Project, Format… Help) causes one of drop-down menus to appear. The user can select required menu. Tool bar: The third line is called the Standard Tool bar. The icons on this line duplicate several of the more commonly used menu items. It acts as a short cut to select the menu UOG, IS Department Ins. G/M 9
  • 10. … Form design and project container windows: The Form design window is where the user interface is actually designed by placing the controls from Tool Box. Each control can be moved, resized and its properties can be assigned using Properties Window. Tool box: The Toolbox contains commonly used controls. A control can be selected and placed in the Form by double clicking on the control or by clicking once on the control, then clicking on the desired location within the form. The associated code can be viewed or edited by double clicking on the control UOG, IS Department Ins. G/M 10
  • 11. … Properties window: Each Object has its own unique list of properties. The Properties Window allows assigning or changing the properties. Project window: The Project Window displays a hierarchical list of the files associated with a given project. Form layout window: This window specifies the screen location of the forms within a project, the location can be changed by dragging the form icon to the desired position Immediate window: This window is very useful for debugging a project. Whenever a variable or expression is entered, the corresponding value will be shown immediately UOG, IS Department Ins. G/M 11
  • 12. 1.3 Building Your First Application Developing VB projects To develop VB projects, the three steps process for planning the project and then repeat the process for creating the project is to be done. Planning Design the User Interface: Draw the forms and controls with the names Plan the Properties: Specify the properties of all controls to set or change during the design of the form Plan the basic code: Plan the procedures to be executed when the project runs. Write the pseudo code, which is an English expression or comment the part that describes the action. UOG, IS Department Ins. G/M 12
  • 13. … Programming፡ Define the User Interface : Create the forms and controls designed in the planning stage Set the Properties : Define the properties of the controls Write the Visual Basic code : Write VB programming statements to carry out the actions needed. UOG, IS Department Ins. G/M 13
  • 14. Object’s Properties Can Be Set In Two Ways 1. Setting Properties of Objects at Design Time Properties can be changed by typing a new value or choosing from a list of predefined settings (available as a drop down list) in Properties Window. A very important property for each object is its name. The name is used by Visual Basic to refer to a particular object in code. UOG, IS Department Ins. G/M 14
  • 15. … 2. Setting Properties at Run Time: You can also set or modify properties while your application is running. To do this, you must write some code. The code format is: ObjectName.Property = NewValue Such a format is referred to as dot notation. For example, to change the BackColor property of a form name frmStart, we'd type: frmStart.BackColor = BLUE UOG, IS Department Ins. G/M 15
  • 16. 1.4 Using the intrinsic controls There are about 20 controls which are built in to VB. These controls are called intrinsic controls. Every one of the intrinsic controls are available to every VB program you write. When you create a "New" VB project, all 20 of the intrinsic controls will show up in Toolbox. This is true for all versions of VB. UOG, IS Department Ins. G/M 16
  • 17. The Most Useful Intrinsic Controls These intrinsic controls are pretty much used on every VB application. Start your learning with these and then branch out. each of the controls:  CommandButton  ImageBox  Option Button  CheckBox  PictureBox  TextBox  ListBox  Label  ComboListBox UOG, IS Department Ins. G/M 17
  • 18. 1.5. Working with Properties, Methods, and Events Properties Objects are described with "properties" (data) which tell you what they look like, where they go, how they will act, and what they contain. Properties often describe physical properties of the object (color or size), but they can also describe behavior, and the data contained by an object. UOG, IS Department Ins. G/M 18
  • 19. … Examples of properties include: Appearance___color Behavior__dragging,visibility Position___top,left.width,height Content___text,graphics Font__name,size,bold,italic Value__data stored by the object The following example shows the property list for the "lastname" text box... UOG, IS Department Ins. G/M 19
  • 20. … UOG, IS Department Ins. G/M 20
  • 21. … Methods Objects usually have many things that they can do or that can be done to them. These are predefined procedures that often modify properties of the object such as its location. For example: Move—change the location of an object Drag–allow it to be dragged with by the mouse Paint—display or redisplay the object Draw (Point, Line)—use the object to draw (e.g., use a mouse) or draw with the object (e.g., a picture object) UOG, IS Department Ins. G/M 21
  • 22. … In the following example, the text1.move will cause the text box to move and be resized when the button is clicked UOG, IS Department Ins. G/M 22
  • 23. … In many cases, values are passed to methods that change property values. For example, the "move" method in Visual Basic is given values for the left and top position as well as height and width. The properties for left, top, width, and height are changed by the "move" method. UOG, IS Department Ins. G/M 23
  • 24. … Events The secret to how most windows-based programs lies in behaviors called "events". Events are triggered when windows are "loaded," buttons are "clicked," or text boxes are "changed." These events drive the program. Objects can respond to stimuli or things that are done to them. For example: Click, Double Click, Mouse Down, Over, Up, drag change The following example from Visual Basic shows the event list for the push button... UOG, IS Department Ins. G/M 24
  • 25. … UOG, IS Department Ins. G/M 25
  • 26. … In many programming systems such as Visual Basic and JavaScript, objects are associated with behavior by appending a descriptive behavioral term to the name of the object. For example: "gobutton_click" indicating that the button has been clicked. In some cases, certain events such as "onclick" are explicitly associated with the object, a button. UOG, IS Department Ins. G/M 26
  • 27. From a programming perspective, events are where the work is done. Code is attached to events to drive a program. For example: Sub command1_click () Text1.text = "Hello World" End Sub In this example: There are, at least, 2 objects (button and text box) and the window. The event is triggered when the user clicks the button, Clicking the button (an event) triggers the command1_click subroutine, Which contains code for updating the text box. Code written for events may be used to call other procedures, change properties, or invoke methods. UOG, IS Department Ins. G/M 27
  • 28. 1.6.Working with Projects in event driven Programming Opening, saving and running VB projects An existing project can be opened through the New project window by selecting the project name listed under the Existing or the Recent tab. Once the project is opened, the form may not be visible; the desired form can be opened using the Project window. To save a new VB project for the first time, choose Save Project As from the File menu. To save an updated version of a previously saved project, click on the Save Project from the File menu or Tool bar. The VB project can be executed by clicking the Start Button in the Tool bar or select Start from the Run menu. The execution can be temporarily suspended by clicking on the Break button or Break from Run menu. UOG, IS Department Ins. G/M 28
  • 29. 29 NB. Discus the following in group Procedural vs. Event-Driven Programming • Procedural programming is executed in procedural order. • In event-driven programming, code is executed upon activation of events.
  • 30. 30 “Hello World!” of Event-Driven Programming • The example displays a button in the frame. A message is displayed on the console when a button is clicked. HandleEvent Run
  • 31. The End UOG, IS Department Ins. G/M 31