SlideShare a Scribd company logo
1 of 28
Download to read offline
Computing

Lesson 2 – Properties and Methods
Quick revision quiz
1. What type of Visual Basic program creates a
   standard Windows application?
2. What window is used to change the properties
   (eg size, name,text) of a form or object?
3. How do you access the code of a control/object?
4. Which property of a picture box do you set to
   display an image?
5. What is the default action/event for a button
   (control)?
Answer time
1.   Windows Form Application
2.   The PROPERTIES window
3.   Double click!
4.   The IMAGE property
5.   Click!
Lesson Objectives
1. Use controls to modify the appearance of a
   Windows Form Application
2. Describe what a METHOD is
3. Use a Method in a code example
Revision – what is a control?
Anything that you can use in a program /
 application to trigger an event or call a
                procedure
Practical Revision Time!
1. Go to Visual Studio
2. (if you haven’t already) check your:
     Tools>Options>Projects & Solutions settings
3. File > Open > Picture Box/Viewer
Let’s do our usual admin!
• Check the toolbox is pinned to the left
• Check the properties window is sorted A-Z
• Click once on the Form in the middle
Add a button with the properties:
              Name                                      btnEnlarge

            Location                                      338,261

                Size                                        21,23

                Text                                           +

NOTE!!!! If you changed the sizes/locations of your form/controls last lesson, you
 will need to adjust the properties shown on this slide to match your form!!!!!!
Add ANOTHER button with the properties:
               Name                                      btnShrink

             Location                                      359,261

                 Size                                        21,23

                 Text                                           -

 NOTE!!!! If you changed the sizes/locations of your form/controls last lesson, you
  will need to adjust the properties shown on this slide to match your form!!!!!!
Double click on the ‘+’ button
Add the following code (no pressing the enter
key yet):
         Me.

Notice what happens when you type in the .


Scroll down to ‘Width’ and then press the TAB
key to auto select it!
Let’s keep typing…
You should now have:
     Me.Width
Keep typing so that you end up with:
     Me.Width = Me.Width + 100
     Me.Height = Me.Height + 100

  (Making sure to press the Enter key after each line)
Double click on the ‘-’ button
Type in this code:
     Me.Width = Me.Width - 100
     Me.Height = Me.Height - 100

 (Making sure to press the Enter key after each line)
Try running your program
1. Click the + button on your form
2. Click the – button on your form
3. Get it to a size you are happy with
4. Try opening an image using the “Select
   Picture’ button
5. Now resize the window using the buttons to
   see what happens!
6. Save it and then File > Close
Understanding Methods
OBJECT       METHODS


              Bark

DOG          Wag Tail

               Eat
To put it simply
  Invoking / triggering a method, code is executed

                  or, in English…

A method makes something happen in your program
How do I tell the difference between
     properties and methods?
A method looks like:
     AlbumForm.ShowDialog()
  or
     Me.Close()

A property change looks like:

     Me.Width = Me.Width + 100
Win Form App 2 – Web Browser

‘Title’ Property




 This button will invoke a
method to load a web page
    from the internet!



 ‘TextBox.Text’ Property
  will be the address of
       our web page
Web Browser – Create New Project
File >
   New >
       Project >
          Windows Form Application

Name - SimpleWebBrowser
Web Browser – Add Controls (Web Browser)


                     1. Add WebBrowser
                        from ToolBox
                     2. Click on the Smart
                        Tag arrow as shown
                     3. Select ‘Unlock in
                        Parent Container’
                     4. Adjust the size so
                        that there is some
                        space at the bottom
                        for the other parts
Web Browser – Add Controls (Text Box)
1. Add TextBox from
   Common Controls
2. Move it to the
   bottom left
3. Edit its properties
   to be:
  1. Name – TextBox1
  2. Text – (leave blank)
Web Browser – Add Controls (Button)
1. Add a Button from
   Common Controls
2. Move it to the
   bottom right
3. Edit its properties
   to be:
  1. Name – TextBox1
  2. Text – ‘Show’
Web Browser – Check layout
1. Your form should
   look like this with:
  1. Web Browser
  2. ‘Show’ button
  3. Text Box
Double Click on the button
Type in the following code:
      WebBrowser1.Navigate(TextBox1.Text)

Your code should look like (the green bit is an
optional comment):
How does this work?




The WebBrowser Control uses the Navigate() method to navigate to the Text Property of
the textbox (which just happens to be the website address that you typed in)
Summary
• A method makes something happen in code
• A property changes how something looks
• Properties and Methods work together in
  programs
Quiz Time!
1. An attribute that changes the state of an
   object is called a …………?
2. To change the value of a property, the
   property is referenced on which side of the
   =?
3. Visual Basic 2010 is known as am object-
   oriented language – true or false?
Quiz Time!
1. Property
2. Left
3. True!
Done! Questions?

More Related Content

What's hot

An introduction to microsoft_word
An introduction to microsoft_wordAn introduction to microsoft_word
An introduction to microsoft_worduzmabb12045
 
Tutorial for PowerPoint 2007
Tutorial for PowerPoint 2007Tutorial for PowerPoint 2007
Tutorial for PowerPoint 2007davidmedvegy
 
Access 2007 tut
Access 2007 tutAccess 2007 tut
Access 2007 tutfeezy11
 
Microsoft Office PowerPoint 2007 - Lesson 1
Microsoft Office PowerPoint 2007 - Lesson 1Microsoft Office PowerPoint 2007 - Lesson 1
Microsoft Office PowerPoint 2007 - Lesson 1Samantha TerBeest
 
Lesson 6 cs5
Lesson 6   cs5Lesson 6   cs5
Lesson 6 cs5dtelepos
 
Microsoft office word 2007
Microsoft office word 2007Microsoft office word 2007
Microsoft office word 2007Mukul Kumar
 
Grasping The LightSwitch Paradigm
Grasping The LightSwitch ParadigmGrasping The LightSwitch Paradigm
Grasping The LightSwitch ParadigmAndrew Brust
 
Ms publisher parts and functions
Ms publisher parts and functionsMs publisher parts and functions
Ms publisher parts and functionsLeona Rose Beltran
 
Ppt 2007 tutorial complete
Ppt 2007 tutorial completePpt 2007 tutorial complete
Ppt 2007 tutorial completeMaster Jhay
 
MS PowerPoint 2010 tutorial 1
MS PowerPoint 2010 tutorial 1MS PowerPoint 2010 tutorial 1
MS PowerPoint 2010 tutorial 1Khalfan Alshuaili
 
Microsoft® Office Keyboard Shortcuts
Microsoft® Office Keyboard ShortcutsMicrosoft® Office Keyboard Shortcuts
Microsoft® Office Keyboard Shortcutslfish
 
An introduction to microsoft office 2007 lecture
An introduction to microsoft office 2007 lectureAn introduction to microsoft office 2007 lecture
An introduction to microsoft office 2007 lectureSukh Sandhu
 
Training Computer Users - How to Make a PowerPoint Presentation
Training Computer Users - How to Make a PowerPoint PresentationTraining Computer Users - How to Make a PowerPoint Presentation
Training Computer Users - How to Make a PowerPoint Presentationrcanfield1
 
The visual studio start page is shown in the figure below
The visual studio start page is shown in the figure belowThe visual studio start page is shown in the figure below
The visual studio start page is shown in the figure belowTan Ps
 
Triad 2010 power_point_chapter_3
Triad 2010 power_point_chapter_3Triad 2010 power_point_chapter_3
Triad 2010 power_point_chapter_3Dalia Saeed
 
Ms excel (page layout)
Ms excel (page layout)Ms excel (page layout)
Ms excel (page layout)Saransh Arora
 

What's hot (20)

An introduction to microsoft_word
An introduction to microsoft_wordAn introduction to microsoft_word
An introduction to microsoft_word
 
Tutorial for PowerPoint 2007
Tutorial for PowerPoint 2007Tutorial for PowerPoint 2007
Tutorial for PowerPoint 2007
 
Access 2007 tut
Access 2007 tutAccess 2007 tut
Access 2007 tut
 
Microsoft Office PowerPoint 2007 - Lesson 1
Microsoft Office PowerPoint 2007 - Lesson 1Microsoft Office PowerPoint 2007 - Lesson 1
Microsoft Office PowerPoint 2007 - Lesson 1
 
Lesson 6 cs5
Lesson 6   cs5Lesson 6   cs5
Lesson 6 cs5
 
Microsoft power point 2007
Microsoft power point 2007Microsoft power point 2007
Microsoft power point 2007
 
Microsoft office word 2007
Microsoft office word 2007Microsoft office word 2007
Microsoft office word 2007
 
Grasping The LightSwitch Paradigm
Grasping The LightSwitch ParadigmGrasping The LightSwitch Paradigm
Grasping The LightSwitch Paradigm
 
Manual de microsoft power point 2010
Manual de microsoft power point 2010Manual de microsoft power point 2010
Manual de microsoft power point 2010
 
Introduction to microsoft word 2007
Introduction to microsoft word 2007Introduction to microsoft word 2007
Introduction to microsoft word 2007
 
Ms publisher parts and functions
Ms publisher parts and functionsMs publisher parts and functions
Ms publisher parts and functions
 
Ppt 2007 tutorial complete
Ppt 2007 tutorial completePpt 2007 tutorial complete
Ppt 2007 tutorial complete
 
MS PowerPoint 2010 tutorial 1
MS PowerPoint 2010 tutorial 1MS PowerPoint 2010 tutorial 1
MS PowerPoint 2010 tutorial 1
 
Microsoft® Office Keyboard Shortcuts
Microsoft® Office Keyboard ShortcutsMicrosoft® Office Keyboard Shortcuts
Microsoft® Office Keyboard Shortcuts
 
An introduction to microsoft office 2007 lecture
An introduction to microsoft office 2007 lectureAn introduction to microsoft office 2007 lecture
An introduction to microsoft office 2007 lecture
 
Presentation
PresentationPresentation
Presentation
 
Training Computer Users - How to Make a PowerPoint Presentation
Training Computer Users - How to Make a PowerPoint PresentationTraining Computer Users - How to Make a PowerPoint Presentation
Training Computer Users - How to Make a PowerPoint Presentation
 
The visual studio start page is shown in the figure below
The visual studio start page is shown in the figure belowThe visual studio start page is shown in the figure below
The visual studio start page is shown in the figure below
 
Triad 2010 power_point_chapter_3
Triad 2010 power_point_chapter_3Triad 2010 power_point_chapter_3
Triad 2010 power_point_chapter_3
 
Ms excel (page layout)
Ms excel (page layout)Ms excel (page layout)
Ms excel (page layout)
 

Viewers also liked

Satellite communication
Satellite communicationSatellite communication
Satellite communicationkarthika nadar
 
Introduction To Outlook Express
Introduction To Outlook ExpressIntroduction To Outlook Express
Introduction To Outlook Expressputer_geeket
 
The Magic of Mobile Broadband: Wireless Fundamentals
The Magic of Mobile Broadband: Wireless FundamentalsThe Magic of Mobile Broadband: Wireless Fundamentals
The Magic of Mobile Broadband: Wireless FundamentalsQualcomm Research
 
Email setup for microsoft outlook
Email setup for microsoft outlookEmail setup for microsoft outlook
Email setup for microsoft outlookDale Carter
 
Methods of connecting internet
Methods of connecting internetMethods of connecting internet
Methods of connecting internetTittu Anna
 
Types of internet connections
Types of internet connectionsTypes of internet connections
Types of internet connectionsadrianne1114
 
Outlook Presentation
Outlook PresentationOutlook Presentation
Outlook Presentationtamil999
 
Types of internet connections
Types of internet connectionsTypes of internet connections
Types of internet connectionsyashgaba
 

Viewers also liked (13)

Extending the web browser
Extending the web browserExtending the web browser
Extending the web browser
 
Satellite communication
Satellite communicationSatellite communication
Satellite communication
 
Introduction To Outlook Express
Introduction To Outlook ExpressIntroduction To Outlook Express
Introduction To Outlook Express
 
The Magic of Mobile Broadband: Wireless Fundamentals
The Magic of Mobile Broadband: Wireless FundamentalsThe Magic of Mobile Broadband: Wireless Fundamentals
The Magic of Mobile Broadband: Wireless Fundamentals
 
Email setup for microsoft outlook
Email setup for microsoft outlookEmail setup for microsoft outlook
Email setup for microsoft outlook
 
Wireless broadband
Wireless broadband Wireless broadband
Wireless broadband
 
Methods of connecting internet
Methods of connecting internetMethods of connecting internet
Methods of connecting internet
 
Basic of MS Outlook
Basic of MS OutlookBasic of MS Outlook
Basic of MS Outlook
 
Types of internet connections
Types of internet connectionsTypes of internet connections
Types of internet connections
 
Outlook Presentation
Outlook PresentationOutlook Presentation
Outlook Presentation
 
Types of internet connections
Types of internet connectionsTypes of internet connections
Types of internet connections
 
Web browser
Web browserWeb browser
Web browser
 
Web Browsers
Web BrowsersWeb Browsers
Web Browsers
 

Similar to Button controls and using methods to make a simple web browser

Web Server Controls VB Set 1
Web Server Controls VB Set 1Web Server Controls VB Set 1
Web Server Controls VB Set 1sunmitraeducation
 
VB.Net-Controls and events
VB.Net-Controls and eventsVB.Net-Controls and events
VB.Net-Controls and eventsPrachi Sasankar
 
Cis 407 i lab 2 of 7
Cis 407 i lab 2 of 7Cis 407 i lab 2 of 7
Cis 407 i lab 2 of 7helpido9
 
Visual Basic IDE Introduction
Visual Basic IDE IntroductionVisual Basic IDE Introduction
Visual Basic IDE IntroductionAhllen Javier
 
Visual Basic IDE Intro.pdf
Visual Basic IDE Intro.pdfVisual Basic IDE Intro.pdf
Visual Basic IDE Intro.pdfsheenmarie0212
 
Oracle Forms Tutorial (www.aboutoracleapps.com)
Oracle Forms Tutorial (www.aboutoracleapps.com)Oracle Forms Tutorial (www.aboutoracleapps.com)
Oracle Forms Tutorial (www.aboutoracleapps.com)magupta26
 
Power Point Project 5
Power Point Project 5Power Point Project 5
Power Point Project 5lonetree
 
Cis407 a ilab 2 web application development devry university
Cis407 a ilab 2 web application development devry universityCis407 a ilab 2 web application development devry university
Cis407 a ilab 2 web application development devry universitylhkslkdh89009
 
Technology and Livelihood Education IV
Technology and Livelihood Education IVTechnology and Livelihood Education IV
Technology and Livelihood Education IVKenneth Osabal
 
Buttons In .net Visual Basic
Buttons In .net Visual BasicButtons In .net Visual Basic
Buttons In .net Visual Basicmanish maurya
 
Windows Forms For Beginners Part - 1
Windows Forms For Beginners Part - 1Windows Forms For Beginners Part - 1
Windows Forms For Beginners Part - 1Bhushan Mulmule
 

Similar to Button controls and using methods to make a simple web browser (20)

Web Server Controls VB Set 1
Web Server Controls VB Set 1Web Server Controls VB Set 1
Web Server Controls VB Set 1
 
VB.Net-Controls and events
VB.Net-Controls and eventsVB.Net-Controls and events
VB.Net-Controls and events
 
Cis 407 i lab 2 of 7
Cis 407 i lab 2 of 7Cis 407 i lab 2 of 7
Cis 407 i lab 2 of 7
 
Visual Basic IDE Introduction
Visual Basic IDE IntroductionVisual Basic IDE Introduction
Visual Basic IDE Introduction
 
Visual Basic IDE Intro.pdf
Visual Basic IDE Intro.pdfVisual Basic IDE Intro.pdf
Visual Basic IDE Intro.pdf
 
Web Server Controls CS Set
Web Server Controls CS Set Web Server Controls CS Set
Web Server Controls CS Set
 
Oracle Forms Tutorial (www.aboutoracleapps.com)
Oracle Forms Tutorial (www.aboutoracleapps.com)Oracle Forms Tutorial (www.aboutoracleapps.com)
Oracle Forms Tutorial (www.aboutoracleapps.com)
 
Visual Basic.pptx
Visual Basic.pptxVisual Basic.pptx
Visual Basic.pptx
 
Power Point Project 5
Power Point Project 5Power Point Project 5
Power Point Project 5
 
Unit2
Unit2Unit2
Unit2
 
Visual basic
Visual basicVisual basic
Visual basic
 
Cis407 a ilab 2 web application development devry university
Cis407 a ilab 2 web application development devry universityCis407 a ilab 2 web application development devry university
Cis407 a ilab 2 web application development devry university
 
Technology and Livelihood Education IV
Technology and Livelihood Education IVTechnology and Livelihood Education IV
Technology and Livelihood Education IV
 
Chapter 02
Chapter 02Chapter 02
Chapter 02
 
Buttons In .net Visual Basic
Buttons In .net Visual BasicButtons In .net Visual Basic
Buttons In .net Visual Basic
 
Tugas testing
Tugas testingTugas testing
Tugas testing
 
Vs c# lecture1
Vs c# lecture1Vs c# lecture1
Vs c# lecture1
 
Controls events
Controls eventsControls events
Controls events
 
Vp lecture1 ararat
Vp lecture1 araratVp lecture1 ararat
Vp lecture1 ararat
 
Windows Forms For Beginners Part - 1
Windows Forms For Beginners Part - 1Windows Forms For Beginners Part - 1
Windows Forms For Beginners Part - 1
 

Recently uploaded

Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfinfogdgmi
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostMatt Ray
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdfPedro Manuel
 
Babel Compiler - Transforming JavaScript for All Browsers.pptx
Babel Compiler - Transforming JavaScript for All Browsers.pptxBabel Compiler - Transforming JavaScript for All Browsers.pptx
Babel Compiler - Transforming JavaScript for All Browsers.pptxYounusS2
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxGDSC PJATK
 
20200723_insight_release_plan_v6.pdf20200723_insight_release_plan_v6.pdf
20200723_insight_release_plan_v6.pdf20200723_insight_release_plan_v6.pdf20200723_insight_release_plan_v6.pdf20200723_insight_release_plan_v6.pdf
20200723_insight_release_plan_v6.pdf20200723_insight_release_plan_v6.pdfJamie (Taka) Wang
 
Cloud Revolution: Exploring the New Wave of Serverless Spatial Data
Cloud Revolution: Exploring the New Wave of Serverless Spatial DataCloud Revolution: Exploring the New Wave of Serverless Spatial Data
Cloud Revolution: Exploring the New Wave of Serverless Spatial DataSafe Software
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfDaniel Santiago Silva Capera
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024SkyPlanner
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.YounusS2
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPathCommunity
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
RAG Patterns and Vector Search in Generative AI
RAG Patterns and Vector Search in Generative AIRAG Patterns and Vector Search in Generative AI
RAG Patterns and Vector Search in Generative AIUdaiappa Ramachandran
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IES VE
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAshyamraj55
 
Digital magic. A small project for controlling smart light bulbs.
Digital magic. A small project for controlling smart light bulbs.Digital magic. A small project for controlling smart light bulbs.
Digital magic. A small project for controlling smart light bulbs.francesco barbera
 
Introduction to Quantum Computing
Introduction to Quantum ComputingIntroduction to Quantum Computing
Introduction to Quantum ComputingGDSC PJATK
 
Things you didn't know you can use in your Salesforce
Things you didn't know you can use in your SalesforceThings you didn't know you can use in your Salesforce
Things you didn't know you can use in your SalesforceMartin Humpolec
 
Do we need a new standard for visualizing the invisible?
Do we need a new standard for visualizing the invisible?Do we need a new standard for visualizing the invisible?
Do we need a new standard for visualizing the invisible?SANGHEE SHIN
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 

Recently uploaded (20)

Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdf
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdf
 
Babel Compiler - Transforming JavaScript for All Browsers.pptx
Babel Compiler - Transforming JavaScript for All Browsers.pptxBabel Compiler - Transforming JavaScript for All Browsers.pptx
Babel Compiler - Transforming JavaScript for All Browsers.pptx
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptx
 
20200723_insight_release_plan_v6.pdf20200723_insight_release_plan_v6.pdf
20200723_insight_release_plan_v6.pdf20200723_insight_release_plan_v6.pdf20200723_insight_release_plan_v6.pdf20200723_insight_release_plan_v6.pdf
20200723_insight_release_plan_v6.pdf20200723_insight_release_plan_v6.pdf
 
Cloud Revolution: Exploring the New Wave of Serverless Spatial Data
Cloud Revolution: Exploring the New Wave of Serverless Spatial DataCloud Revolution: Exploring the New Wave of Serverless Spatial Data
Cloud Revolution: Exploring the New Wave of Serverless Spatial Data
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation Developers
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
RAG Patterns and Vector Search in Generative AI
RAG Patterns and Vector Search in Generative AIRAG Patterns and Vector Search in Generative AI
RAG Patterns and Vector Search in Generative AI
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
 
Digital magic. A small project for controlling smart light bulbs.
Digital magic. A small project for controlling smart light bulbs.Digital magic. A small project for controlling smart light bulbs.
Digital magic. A small project for controlling smart light bulbs.
 
Introduction to Quantum Computing
Introduction to Quantum ComputingIntroduction to Quantum Computing
Introduction to Quantum Computing
 
Things you didn't know you can use in your Salesforce
Things you didn't know you can use in your SalesforceThings you didn't know you can use in your Salesforce
Things you didn't know you can use in your Salesforce
 
Do we need a new standard for visualizing the invisible?
Do we need a new standard for visualizing the invisible?Do we need a new standard for visualizing the invisible?
Do we need a new standard for visualizing the invisible?
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 

Button controls and using methods to make a simple web browser

  • 1. Computing Lesson 2 – Properties and Methods
  • 2. Quick revision quiz 1. What type of Visual Basic program creates a standard Windows application? 2. What window is used to change the properties (eg size, name,text) of a form or object? 3. How do you access the code of a control/object? 4. Which property of a picture box do you set to display an image? 5. What is the default action/event for a button (control)?
  • 3. Answer time 1. Windows Form Application 2. The PROPERTIES window 3. Double click! 4. The IMAGE property 5. Click!
  • 4. Lesson Objectives 1. Use controls to modify the appearance of a Windows Form Application 2. Describe what a METHOD is 3. Use a Method in a code example
  • 5. Revision – what is a control? Anything that you can use in a program / application to trigger an event or call a procedure
  • 6. Practical Revision Time! 1. Go to Visual Studio 2. (if you haven’t already) check your: Tools>Options>Projects & Solutions settings 3. File > Open > Picture Box/Viewer
  • 7. Let’s do our usual admin! • Check the toolbox is pinned to the left • Check the properties window is sorted A-Z • Click once on the Form in the middle
  • 8. Add a button with the properties: Name btnEnlarge Location 338,261 Size 21,23 Text + NOTE!!!! If you changed the sizes/locations of your form/controls last lesson, you will need to adjust the properties shown on this slide to match your form!!!!!!
  • 9. Add ANOTHER button with the properties: Name btnShrink Location 359,261 Size 21,23 Text - NOTE!!!! If you changed the sizes/locations of your form/controls last lesson, you will need to adjust the properties shown on this slide to match your form!!!!!!
  • 10. Double click on the ‘+’ button Add the following code (no pressing the enter key yet): Me. Notice what happens when you type in the . Scroll down to ‘Width’ and then press the TAB key to auto select it!
  • 11. Let’s keep typing… You should now have: Me.Width Keep typing so that you end up with: Me.Width = Me.Width + 100 Me.Height = Me.Height + 100 (Making sure to press the Enter key after each line)
  • 12. Double click on the ‘-’ button Type in this code: Me.Width = Me.Width - 100 Me.Height = Me.Height - 100 (Making sure to press the Enter key after each line)
  • 13. Try running your program 1. Click the + button on your form 2. Click the – button on your form 3. Get it to a size you are happy with 4. Try opening an image using the “Select Picture’ button 5. Now resize the window using the buttons to see what happens! 6. Save it and then File > Close
  • 14. Understanding Methods OBJECT METHODS Bark DOG Wag Tail Eat
  • 15. To put it simply Invoking / triggering a method, code is executed or, in English… A method makes something happen in your program
  • 16. How do I tell the difference between properties and methods? A method looks like: AlbumForm.ShowDialog() or Me.Close() A property change looks like: Me.Width = Me.Width + 100
  • 17. Win Form App 2 – Web Browser ‘Title’ Property This button will invoke a method to load a web page from the internet! ‘TextBox.Text’ Property will be the address of our web page
  • 18. Web Browser – Create New Project File > New > Project > Windows Form Application Name - SimpleWebBrowser
  • 19. Web Browser – Add Controls (Web Browser) 1. Add WebBrowser from ToolBox 2. Click on the Smart Tag arrow as shown 3. Select ‘Unlock in Parent Container’ 4. Adjust the size so that there is some space at the bottom for the other parts
  • 20. Web Browser – Add Controls (Text Box) 1. Add TextBox from Common Controls 2. Move it to the bottom left 3. Edit its properties to be: 1. Name – TextBox1 2. Text – (leave blank)
  • 21. Web Browser – Add Controls (Button) 1. Add a Button from Common Controls 2. Move it to the bottom right 3. Edit its properties to be: 1. Name – TextBox1 2. Text – ‘Show’
  • 22. Web Browser – Check layout 1. Your form should look like this with: 1. Web Browser 2. ‘Show’ button 3. Text Box
  • 23. Double Click on the button Type in the following code: WebBrowser1.Navigate(TextBox1.Text) Your code should look like (the green bit is an optional comment):
  • 24. How does this work? The WebBrowser Control uses the Navigate() method to navigate to the Text Property of the textbox (which just happens to be the website address that you typed in)
  • 25. Summary • A method makes something happen in code • A property changes how something looks • Properties and Methods work together in programs
  • 26. Quiz Time! 1. An attribute that changes the state of an object is called a …………? 2. To change the value of a property, the property is referenced on which side of the =? 3. Visual Basic 2010 is known as am object- oriented language – true or false?
  • 27. Quiz Time! 1. Property 2. Left 3. True!

Editor's Notes

  1. Lesson is split into two parts, may be split over two periods if required. The parts are:Reinforce the use of controls and properties through carrying on with the PictureBox Viewer project.Learn about methods and use the WebBrowser example to demonstrate the use of methodsThis may be split over two lessons if required due to time constraints.
  2. If you don’t have picture box viewer already made then you can unhide slides 11-19 that give you the instructions and code for making the Picture Box Viewer
  3. Text entered into the Title bar appears in the open file dialog box that opens later
  4. Clicking on a button is called an event. The code that you put in the button is called an event handler, ie it tells the program the instructions to carry out once the button is clicked.
  5. Finished code: Private Sub btnSelectPicture_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSelectPicture.Click ' Show the open file dialog box. If ofdSelectPicture.ShowDialog = DialogResult.OK Then ' Load the picture into the picture box. picShowPicture.Image = Image.FromFile(ofdSelectPicture.FileName) ' Show the name of the file in the form's caption. Me.Text = "Picture Viewer(" & ofdSelectPicture.FileName & ")" End If End SubComments in green
  6. Finished code: Private Sub btnQuit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuit.Click ' Close the window and exit the application Me.Close() End SubComments in green
  7. The typing of the period will prompt VS to produce a drop down menu that will afford you a number of options to choose form that suit the controls in use. This is called Intellisense (aka predictive text).
  8. The typing of the period will prompt VS to produce a drop down menu that will afford you a number of options to choose form that suit the controls in use. This is called Intellisense (aka predictive text).
  9. They may have named the Select Picture button as something else – Image, select etcetc
  10. In addition to properties, most objects have methods. Methods are actions the object can perform, in contrast to attributes, which describe the object. To understand this distinction, think about the pet object on the slide. A Dog object has a certain set of actions it can perform. These actions, called methods in Visual Basic, include barking, tail wagging, and eating your homework. The figure above illustrates the Dog Object and its methods.
  11. Examples of common methods would be saving or deleting a record in a database. Properties are different in that they are used to get and set the attributes of an object (eg size/location/colouretc)
  12. The notable difference in the coding of a method versus properties is the use of parentheses (brackets).
  13. This is what we are going to build in the next example that uses methods and properties/controls to create a basic Windows Form Application to browse and view web pages.Follow the instructions over the next few slides to build your first web browser!
  14. Make sure to name the project before hitting ok/create/new button!
  15. The Web Browser control will automatically take up the whole of the form window if allowed. To manually override this, we need to unlock it from the confines of the form. You will see why soon!