Controls

4,751 views
4,631 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
4,751
On SlideShare
0
From Embeds
0
Number of Embeds
4,038
Actions
Shares
0
Downloads
21
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Controls

  1. 1. Windows GUIControls and Events VB.NET 1
  2. 2. Windows GUIVisual Basic is the most widely used toolfor developing Windows applications.Windows applications utilise a GUI thatprovides visual cues to the user that allowthe user to work intuitively and efficiently.Windows applications contain WYSIWYG“What You See Is What You Get” 2
  3. 3. Working with ObjectsAn object is anything we might use in ourapplication for acquiring, manipulating, orpresenting data or information.An object contains properties (data) andmethods (actions for manipulating anobject’s data).An object is defined once as a class. 3
  4. 4. Working with Objects (cont.)The developer creates as many instances of theobject as necessary for the application.The .NET class library is a large library ofclasses with reusable code included in theMicrosoft .NET Framework..NET uses namespaces, which are collections ofrelated classes/  System.Windows.Form is the namespace containing classes for creating Window based applications. 4
  5. 5. Reuse and ReliabilityOne of the most powerful features of objectclasses is that they are reusable.The Control class contains numerousproperties and methods common to allcontrols for developing the user interface.Objects can enhance reliability, which isthe result of good design and lots oftesting. Do not reinvent the wheel 5
  6. 6. Control ObjectsThe Button control is considered to be themost basic graphical control.The Label control is used to display textthat cannot be edited by the user.The PictureBox control is used to displaygraphics.The Timer control is used to raise an eventat user-defined intervals. 6
  7. 7. ControlsMenusPictureboxesLabelsTimers 7
  8. 8. ControlsUnderstand and effectively use the TextBox,ListBox, and ComboBox controlsA TextBox control provides GUI form input byproviding an area on the form where the user canenter data while the program is executing.A ListBox control provides GUI form input as alist of items that the user can select by clicking.A ComboBox control combines the functionalityof the TextBox and ListBox controls. 8
  9. 9. TextBox ControlThe TextBox control provides an area forthe user to enter data while the program isexecuting.TextBox controls can also be used todisplay output on the form. 9
  10. 10. TextBox PropertiesProperty DescriptionName (“txt” prefix) used to access the control in codeFont Gets or sets the font of the text displayed in the controlMaxlength Sets the maximum number of characters allowedMultiline Allows more than a single line of text to be enteredPasswordchar Sets the character used to mask typed text (Single line only)ReadOnly Stops text from being edited by the userScrollBars Sets which ScrollBars appear (Multiline only)Text Gets or sets the text displayed in the controlWordWrap Indicates if text is automatically wrapped to next line 10
  11. 11. TextBox Methods 11
  12. 12. ListBox ControlThe ListBox control makes a visible list ofitems.The user can select items in the list usingmouse clicks. 12
  13. 13. ListBox Properties 13
  14. 14. ListBox Methods 14
  15. 15. ComboBox ControlThe ComboBox control combines thefunctionality of the TextBox and ListBoxcontrols.The user can select values from the drop-down list or enter values directly into thetext box area. 15
  16. 16. ComboBox Properties 16
  17. 17. Working with EventsVisual Basic supports event-drivenprogramming in which the applicationrecognizes and responds to events.An event is an action or occurrencerecognized by some object and for whichyou can write code to respond.And event handler contains code thatresponds to a particular event. 17
  18. 18. Event ProceduresThe naming convention for an eventprocedure is the keyword Sub followed bythe name of the triggering object followedby an underscore character followed by thename of the event e.g. Timer event 18
  19. 19. SummaryVisual Basic is an object-oriented, event-drivenlanguage.An object is a self-contained entity that has bothproperties and methods.Most of the objects you will need are available inVB. NET (forms & controls are objects)An event refers to an action or change detected bya program.An event procedure is the method that handles orresponds to an event. 19

×