SlideShare a Scribd company logo
1 of 14
1 
What is Event Driven 
Programming? 
Visual Studio 
and 
VB.NET
2 
P1: Key Features of EDP 
1. Event loops 
2. GUI design (Forms & Controls 
3. Trigger functions 
4. Event handlers
3 
P2: Demonstrate the use of event 
driven tools and techniques 
Using Visual Studio and VB.NET language 
Demonstrate the development process with screenshots 
and code examples, to show the main choices available 
IDE Tools inc: 
GUI form design 
Add & edit controls 
Choice of triggers 
Code colour & dropdown 
Debugging tools 
 Error list 
 Breakpoints & step 
through code 
Coding Techniques inc: 
Variables and Datatypes 
 Const, Global, Local 
 Integer, boolean, decimal, 
string, date 
Selection 
 If...Else & Select...Case 
Loops 
 Fixed & Conditional
4 
Event Loops 
Programmers are often not aware of these: 
The Event loop keeps testing the user interface to see if 
anything has happened e.g. a button click or a key 
pressed. Open Task Manager to see which programs are running 
When an event is detected, it is passed to the list of 
identified trigger functions, which then launches a 
response to the event. 
The event handlers are the actual program code 
modules that are executed when a particular trigger has 
occurred. 
Other (non user) activities can also cause an event to 
trigger – typically used in networking and when reading 
from or writing to files.
5 
Event Loop 
1 User interacts with page 
2 An ‘event’ is triggered 
EVENT! 
The page’s appearance is 3 A code handler runs in response 
updated/modified as a result 
4
6 
Forms and Controls 
A GUI (graphical user interface) is what the user 
sees when the program runs and usually consists of 
one or several forms 
Event driven programming is particularly suitable for 
GUIs - uses WIMP system 
Windows, Icons, Menus, Pointers 
Programmer can assist user with intuitive interface, 
restrict input to a limited range, provide visual 
feedback and context-sensitive help 
Event driven programs respond to events triggered 
by the user via the mouse or keyboard
7 
Forms and Controls 
Common methods for user interaction include clicking 
the mouse or pressing a key 
Each form contains various controls which allow the 
user to interact with the program in different ways 
e.g. Buttons, Textboxes, Labels, Menus, Pictureboxes, Timers 
Wide choice of controls can be customised for use by 
Select from toolbar and drop onto the form 
change its properties in design view (text, image, visible) 
Show form design in IDE and choice of controls in toolbox 
Add different types controls to provide input and feedback 
inc. visual and non-visual controls (timer) 
Change the properties (inc Name) and explain purpose
8 
Trigger functions 
Event driven programs respond to events 
triggered by the user 
The programmer chooses which event(s) 
to respond to by selecting the appropriate 
trigger function. 
Every object has a range of trigger 
functions – one for each possible event 
Different controls have different events 
(events for a text box not the same for a 
button) 
A Button has a Click event, a GotFocus event, a 
MouseHover event etc 
Button events
9 
Trigger Functions 
Triggers can also come from unseen events e.g. Timer 
Double clicking a control will select its default event 
Timer1_Tick() 
MenuItem1_Click() 
Forms also have events inc: 
Load (open for first time, set default values) 
KeyDown (when the user presses a key) 
Demonstrate how to create trigger functions for different controls 
inc. mouse, keyboard and timer (control event) 
Show how to select different triggers for the same control 
Explain how trigger functions are used in your program
10 
Event Handlers 
An event triggers the appropriate event handler 
Event handlers contain the code that runs when an 
event occurs 
These event handlers are self-contained sections of 
code – also called Procedures or Subroutines 
VB.NET uses Sub/End Sub to start and end the code 
This allows the programmer to work on one event of 
one control at a time and makes testing easier
11 
Event Handlers 
Demonstrate and explain different coding techniques 
Variables 
 Different datatypes 
 Local and Global 
Selection 
 If...Else 
 Select...Case 
Loops 
 Fixed loop e.g. For...Next 
 Conditional loop e.g. Do...Loop While 
Show how IDE assists with coding and debugging 
 Pre-written code and drop-down lists showing choice of 
possible commands 
 Errors are highlighted and step through debugging
12 
Advantages 
Flexibility: 
Wide choice of controls and trigger functions - 
programmer can decide what will happen when 
Suitability for GUI: 
WIMP system (Windows, Icons, Menus, Pointers) 
Simplicity and Ease of development: 
Programmers can add and code one object at a 
time, using simple constructs 
Pre-written code and drop-down lists showing 
choice of possible commands 
Errors are highlighted and step through debugging
13 
Disadvantages 
Errors can be more difficult to spot than with 
simpler, procedural programs 
Programs with complex GUIs may be slower 
to load and run than simpler programs – 
particularly if RAM is insufficient 
Programs with too many forms can be very 
confusing and/or frustrating for the user
14 
Which control would a programmer 
use to….? 
Allow a Yes/ No answer only? 
Allow a wide range of keyboard input? 
Limit user input to the numbers 1, 2, 3 & 4? 
Allow a user to subtly change the colour or 
brightness selected in a graphics application 
Allow a user to access commands without the 
mouse, but using keyboard navigation only?

More Related Content

What's hot (20)

Windowforms controls c#
Windowforms controls c#Windowforms controls c#
Windowforms controls c#
 
User Interface
User InterfaceUser Interface
User Interface
 
Jquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript BasicsJquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript Basics
 
Java: GUI
Java: GUIJava: GUI
Java: GUI
 
Maps in android
Maps in androidMaps in android
Maps in android
 
Js ppt
Js pptJs ppt
Js ppt
 
Javascript event handler
Javascript event handlerJavascript event handler
Javascript event handler
 
Namespaces in C#
Namespaces in C#Namespaces in C#
Namespaces in C#
 
Graphical User Interface
Graphical User Interface Graphical User Interface
Graphical User Interface
 
VB.NET:An introduction to Namespaces in .NET framework
VB.NET:An introduction to  Namespaces in .NET frameworkVB.NET:An introduction to  Namespaces in .NET framework
VB.NET:An introduction to Namespaces in .NET framework
 
Modular programming
Modular programmingModular programming
Modular programming
 
User Interface Design Chapter 2 Galiz
User Interface Design Chapter 2 GalizUser Interface Design Chapter 2 Galiz
User Interface Design Chapter 2 Galiz
 
USER INTERFACE DESIGN PPT
USER INTERFACE DESIGN PPTUSER INTERFACE DESIGN PPT
USER INTERFACE DESIGN PPT
 
Class and object
Class and objectClass and object
Class and object
 
Awt controls ppt
Awt controls pptAwt controls ppt
Awt controls ppt
 
C program compiler presentation
C program compiler presentationC program compiler presentation
C program compiler presentation
 
Control Flow Graphs
Control Flow GraphsControl Flow Graphs
Control Flow Graphs
 
Android adapters
Android adaptersAndroid adapters
Android adapters
 
Android UI
Android UIAndroid UI
Android UI
 
Simple xml in .net
Simple xml in .netSimple xml in .net
Simple xml in .net
 

Viewers also liked

Event+driven+programming key+features
Event+driven+programming key+featuresEvent+driven+programming key+features
Event+driven+programming key+featuresFaisal Aziz
 
Event driven programming amazeballs
Event driven programming amazeballsEvent driven programming amazeballs
Event driven programming amazeballsMsWillcox
 
(WRK302) Event-Driven Programming
(WRK302) Event-Driven Programming(WRK302) Event-Driven Programming
(WRK302) Event-Driven ProgrammingAmazon Web Services
 
Event oriented programming
Event oriented programmingEvent oriented programming
Event oriented programmingAshwini Awatare
 
AWS December 2015 Webinar Series - Design Patterns using Amazon DynamoDB
AWS December 2015 Webinar Series - Design Patterns using Amazon DynamoDBAWS December 2015 Webinar Series - Design Patterns using Amazon DynamoDB
AWS December 2015 Webinar Series - Design Patterns using Amazon DynamoDBAmazon Web Services
 
Software development lifecycle
Software development lifecycleSoftware development lifecycle
Software development lifecyclenicky_walters
 
Ndu06 typesof language
Ndu06 typesof languageNdu06 typesof language
Ndu06 typesof languagenicky_walters
 
Design documentation
Design documentationDesign documentation
Design documentationnicky_walters
 

Viewers also liked (20)

Controls
ControlsControls
Controls
 
Event+driven+programming key+features
Event+driven+programming key+featuresEvent+driven+programming key+features
Event+driven+programming key+features
 
Design for edp
Design for edpDesign for edp
Design for edp
 
Event driven programming amazeballs
Event driven programming amazeballsEvent driven programming amazeballs
Event driven programming amazeballs
 
Decisions
DecisionsDecisions
Decisions
 
(WRK302) Event-Driven Programming
(WRK302) Event-Driven Programming(WRK302) Event-Driven Programming
(WRK302) Event-Driven Programming
 
Data types vbnet
Data types vbnetData types vbnet
Data types vbnet
 
Event driventheory
Event driventheoryEvent driventheory
Event driventheory
 
Input output
Input outputInput output
Input output
 
Event oriented programming
Event oriented programmingEvent oriented programming
Event oriented programming
 
Simple debugging
Simple debuggingSimple debugging
Simple debugging
 
Using loops
Using loopsUsing loops
Using loops
 
AWS December 2015 Webinar Series - Design Patterns using Amazon DynamoDB
AWS December 2015 Webinar Series - Design Patterns using Amazon DynamoDBAWS December 2015 Webinar Series - Design Patterns using Amazon DynamoDB
AWS December 2015 Webinar Series - Design Patterns using Amazon DynamoDB
 
Decisions
DecisionsDecisions
Decisions
 
Simple debugging
Simple debuggingSimple debugging
Simple debugging
 
Data types vbnet
Data types vbnetData types vbnet
Data types vbnet
 
Software development lifecycle
Software development lifecycleSoftware development lifecycle
Software development lifecycle
 
Ndu06 typesof language
Ndu06 typesof languageNdu06 typesof language
Ndu06 typesof language
 
Data structures vb
Data structures vbData structures vb
Data structures vb
 
Design documentation
Design documentationDesign documentation
Design documentation
 

Similar to Event Driven Programming with Visual Studio and VB.NET

SWE-401 - 8. Software User Interface Design
SWE-401 - 8. Software User Interface DesignSWE-401 - 8. Software User Interface Design
SWE-401 - 8. Software User Interface Designghayour abbas
 
Introduction to Visual Basic 6.0
Introduction to Visual Basic 6.0Introduction to Visual Basic 6.0
Introduction to Visual Basic 6.0DivyaR219113
 
06 win forms
06 win forms06 win forms
06 win formsmrjw
 
2 Module - Operating Systems Configuration and Use by Mark John Lado
2 Module - Operating Systems Configuration and Use by Mark John Lado2 Module - Operating Systems Configuration and Use by Mark John Lado
2 Module - Operating Systems Configuration and Use by Mark John LadoMark John Lado, MIT
 
WinRunner Training
WinRunner TrainingWinRunner Training
WinRunner Trainingsunny.deb
 
Publication Non Visual Components
Publication Non Visual ComponentsPublication Non Visual Components
Publication Non Visual Componentssatyres
 
2 working with operating system
2 working with operating system2 working with operating system
2 working with operating systemMukesh Thakur
 
Functional Requirements Of System Requirements
Functional Requirements Of System RequirementsFunctional Requirements Of System Requirements
Functional Requirements Of System RequirementsLaura Arrigo
 
visual basic v6 introduction
visual basic v6 introductionvisual basic v6 introduction
visual basic v6 introductionbloodyedge03
 
ANDROID LAB MANUAL.doc
ANDROID LAB MANUAL.docANDROID LAB MANUAL.doc
ANDROID LAB MANUAL.docPalakjaiswal43
 
RPA Developer Kickstarter | Day 3: UI Automation and UiPath Selectors
RPA Developer Kickstarter | Day 3: UI Automation and UiPath SelectorsRPA Developer Kickstarter | Day 3: UI Automation and UiPath Selectors
RPA Developer Kickstarter | Day 3: UI Automation and UiPath SelectorsRohit Radhakrishnan
 

Similar to Event Driven Programming with Visual Studio and VB.NET (20)

SWE-401 - 8. Software User Interface Design
SWE-401 - 8. Software User Interface DesignSWE-401 - 8. Software User Interface Design
SWE-401 - 8. Software User Interface Design
 
Unit 2
Unit 2Unit 2
Unit 2
 
Unit-1.pptx
Unit-1.pptxUnit-1.pptx
Unit-1.pptx
 
2.5 gui
2.5 gui2.5 gui
2.5 gui
 
Introduction to Visual Basic 6.0
Introduction to Visual Basic 6.0Introduction to Visual Basic 6.0
Introduction to Visual Basic 6.0
 
06 win forms
06 win forms06 win forms
06 win forms
 
Unit-1.pptx
Unit-1.pptxUnit-1.pptx
Unit-1.pptx
 
2 Module - Operating Systems Configuration and Use by Mark John Lado
2 Module - Operating Systems Configuration and Use by Mark John Lado2 Module - Operating Systems Configuration and Use by Mark John Lado
2 Module - Operating Systems Configuration and Use by Mark John Lado
 
WinRunner Training
WinRunner TrainingWinRunner Training
WinRunner Training
 
Publication Non Visual Components
Publication Non Visual ComponentsPublication Non Visual Components
Publication Non Visual Components
 
Working with Operating System
Working with Operating SystemWorking with Operating System
Working with Operating System
 
2 working with operating system
2 working with operating system2 working with operating system
2 working with operating system
 
VB.Net GUI Unit_01
VB.Net GUI Unit_01VB.Net GUI Unit_01
VB.Net GUI Unit_01
 
Functional Requirements Of System Requirements
Functional Requirements Of System RequirementsFunctional Requirements Of System Requirements
Functional Requirements Of System Requirements
 
visual basic v6 introduction
visual basic v6 introductionvisual basic v6 introduction
visual basic v6 introduction
 
Software
Software Software
Software
 
ANDROID LAB MANUAL.doc
ANDROID LAB MANUAL.docANDROID LAB MANUAL.doc
ANDROID LAB MANUAL.doc
 
Software
SoftwareSoftware
Software
 
Vb6.0 intro
Vb6.0 introVb6.0 intro
Vb6.0 intro
 
RPA Developer Kickstarter | Day 3: UI Automation and UiPath Selectors
RPA Developer Kickstarter | Day 3: UI Automation and UiPath SelectorsRPA Developer Kickstarter | Day 3: UI Automation and UiPath Selectors
RPA Developer Kickstarter | Day 3: UI Automation and UiPath Selectors
 

Recently uploaded

Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
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
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
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
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
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
 
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
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
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
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
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
 
"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
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 

Recently uploaded (20)

Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
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
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
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
 
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
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
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
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
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)
 
"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...
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 

Event Driven Programming with Visual Studio and VB.NET

  • 1. 1 What is Event Driven Programming? Visual Studio and VB.NET
  • 2. 2 P1: Key Features of EDP 1. Event loops 2. GUI design (Forms & Controls 3. Trigger functions 4. Event handlers
  • 3. 3 P2: Demonstrate the use of event driven tools and techniques Using Visual Studio and VB.NET language Demonstrate the development process with screenshots and code examples, to show the main choices available IDE Tools inc: GUI form design Add & edit controls Choice of triggers Code colour & dropdown Debugging tools  Error list  Breakpoints & step through code Coding Techniques inc: Variables and Datatypes  Const, Global, Local  Integer, boolean, decimal, string, date Selection  If...Else & Select...Case Loops  Fixed & Conditional
  • 4. 4 Event Loops Programmers are often not aware of these: The Event loop keeps testing the user interface to see if anything has happened e.g. a button click or a key pressed. Open Task Manager to see which programs are running When an event is detected, it is passed to the list of identified trigger functions, which then launches a response to the event. The event handlers are the actual program code modules that are executed when a particular trigger has occurred. Other (non user) activities can also cause an event to trigger – typically used in networking and when reading from or writing to files.
  • 5. 5 Event Loop 1 User interacts with page 2 An ‘event’ is triggered EVENT! The page’s appearance is 3 A code handler runs in response updated/modified as a result 4
  • 6. 6 Forms and Controls A GUI (graphical user interface) is what the user sees when the program runs and usually consists of one or several forms Event driven programming is particularly suitable for GUIs - uses WIMP system Windows, Icons, Menus, Pointers Programmer can assist user with intuitive interface, restrict input to a limited range, provide visual feedback and context-sensitive help Event driven programs respond to events triggered by the user via the mouse or keyboard
  • 7. 7 Forms and Controls Common methods for user interaction include clicking the mouse or pressing a key Each form contains various controls which allow the user to interact with the program in different ways e.g. Buttons, Textboxes, Labels, Menus, Pictureboxes, Timers Wide choice of controls can be customised for use by Select from toolbar and drop onto the form change its properties in design view (text, image, visible) Show form design in IDE and choice of controls in toolbox Add different types controls to provide input and feedback inc. visual and non-visual controls (timer) Change the properties (inc Name) and explain purpose
  • 8. 8 Trigger functions Event driven programs respond to events triggered by the user The programmer chooses which event(s) to respond to by selecting the appropriate trigger function. Every object has a range of trigger functions – one for each possible event Different controls have different events (events for a text box not the same for a button) A Button has a Click event, a GotFocus event, a MouseHover event etc Button events
  • 9. 9 Trigger Functions Triggers can also come from unseen events e.g. Timer Double clicking a control will select its default event Timer1_Tick() MenuItem1_Click() Forms also have events inc: Load (open for first time, set default values) KeyDown (when the user presses a key) Demonstrate how to create trigger functions for different controls inc. mouse, keyboard and timer (control event) Show how to select different triggers for the same control Explain how trigger functions are used in your program
  • 10. 10 Event Handlers An event triggers the appropriate event handler Event handlers contain the code that runs when an event occurs These event handlers are self-contained sections of code – also called Procedures or Subroutines VB.NET uses Sub/End Sub to start and end the code This allows the programmer to work on one event of one control at a time and makes testing easier
  • 11. 11 Event Handlers Demonstrate and explain different coding techniques Variables  Different datatypes  Local and Global Selection  If...Else  Select...Case Loops  Fixed loop e.g. For...Next  Conditional loop e.g. Do...Loop While Show how IDE assists with coding and debugging  Pre-written code and drop-down lists showing choice of possible commands  Errors are highlighted and step through debugging
  • 12. 12 Advantages Flexibility: Wide choice of controls and trigger functions - programmer can decide what will happen when Suitability for GUI: WIMP system (Windows, Icons, Menus, Pointers) Simplicity and Ease of development: Programmers can add and code one object at a time, using simple constructs Pre-written code and drop-down lists showing choice of possible commands Errors are highlighted and step through debugging
  • 13. 13 Disadvantages Errors can be more difficult to spot than with simpler, procedural programs Programs with complex GUIs may be slower to load and run than simpler programs – particularly if RAM is insufficient Programs with too many forms can be very confusing and/or frustrating for the user
  • 14. 14 Which control would a programmer use to….? Allow a Yes/ No answer only? Allow a wide range of keyboard input? Limit user input to the numbers 1, 2, 3 & 4? Allow a user to subtly change the colour or brightness selected in a graphics application Allow a user to access commands without the mouse, but using keyboard navigation only?