MELJUN CORTES VB.NET Programming with Visual Basic.NET

771 views

Published on

MELJUN CORTES VB.NET Programming with Visual Basic.NET

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
771
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
38
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

MELJUN CORTES VB.NET Programming with Visual Basic.NET

  1. 1. Part V Programming with Visual Basic .NET MELJUN CORTES
  2. 2. Overview V.1: Using Visual Basic Console Application  Printing a Line of Text  Adding Integers  Performing Comparisons with Equality and Relational Operators  Problems V.2: Using Visual Basic Windows Application  Introduction to Windows Application  Windows Forms  Benefits of Windows Applications  Introduction to Windows Forms  Using Windows Forms  Working with Controls  Working with Data Binding Applications  Creating Multilingual Applications  Printing a Line of Text Using the Graphical User Interface  Flash Card Addition (Finding the Value of Z)  Temperature Conversion  Problems
  3. 3. Using Visual Basic .NET Console Application Applications that contain only text groups  Text output in Console Application is displayed in a command window (also called a console window)   MS Windows 95/98 – command window  MS Windows NT/2000/XP – command prompt
  4. 4. Printing a Line of Text
  5. 5. Common Console Methods  Write method writes the specified information to the standard output stream.  Writeline method writes the specified data, followed by the current line terminator, to the standard output stream.  Read method reads the next character from the standard input stream.  Readline method reads the next line of characters from the standard input stream.
  6. 6. Adding Integers
  7. 7. Performing Comparisons with Equality and Relational Operators 1/2
  8. 8. Performing Comparisons with Equality and Relational Operators 2/2
  9. 9. PROBLEMS  Write a program that will add, subtract, multiply and divide two integers. Diamond (For/Next)  Square (For/Next) 
  10. 10. Solution (for Problem 1)
  11. 11. Solution (for Problem 2)
  12. 12. Solution (for Problem 3)
  13. 13. Using Visual Basic Windows Application A program that executes inside the Windows OS  It includes customized software, that programmers create, as well as software products like MS Word, MS Internet Explorer and Visual Studio .NET 
  14. 14. Windows Forms      Provide a great way to build Windows – applications. Provide many ready-to-use controls in addition to the infrastructure for developing your own controls. The .NET Framework provides many controls with increased built-in functionality that greatly speeds up the development process. Enable developers building Windows based applications to take full advantage of Windows operating system features. Take advantage of many new technologies, including a common language runtime (CLR), an extensive class library, integrated security , and object-oriented design capabilities. Offer full support for quick and easy connection to XML Web Services and building data-aware applications based on the Microsoft ADO.NET data model.
  15. 15. Benefits of Windows Applications Based on the .NET Framework classes  Language-independent  Fast response time  Powerful drawing / graphics capabilities  Time-saving development features  Advanced data-binding  Simple deployment  Richer UI 
  16. 16. Introduction to Windows Forms 1/2   The form is the primary object used for user interaction. A form is an item of screen real estate, usually rectangular, that you can use to present information to and accept input from the user. Types of Windows Forms Standard windows Multiple document interface (MDI) windows Dialog boxes Display for graphical routines
  17. 17. Introduction to Windows Forms 2/2  Forms expose properties, methods, and events  Forms are objects that expose properties, methods, and events.  Properties define the appearance of forms.  Methods define their behavior.  Events define their interaction with the user.  By setting the properties of the form and writing code to respond to its events, you customize the form object to meet the requirements of your application.
  18. 18. Working with Controls 1/2  New control features  Docking,  anchoring, menu editor, etc. New controls  LinkLabel - provides linking to a specified URL, similar to linking through Hypertext Markup Language (HTML). Text displayed by using this control will appear as underlined, and the cursor will change to a hand symbol as the mouse moves over it, firing an event when clicked.  NotifyIcon – enables developers to create applications that you can manage from an icon in the status notification area on the task bar, similar to the SQL ServerTM Service Manager.  PrintPreviewControl – Windows Forms offer a printing framework that makes printing simple.
  19. 19. Working with Controls 2/2  Create your own controls  Enhance existing controls  Create from scratch  Add controls to a form by:  Dragging and dropping from the Toolbox  Writing code to add controls dynamically at run time  Example: Private Sub CreateControl() Dim MyText as New TextBox MyText.Location = New Point(25, 25) Me.Controls.Add (MyText) End Sub
  20. 20. Working with Data Binding Applications 1/2  Set properties by using data binding  You can bind any property of any control to the data source. With the .NET Framework, you have the option of setting other properties through binding. Some of the functions of data binding include:     Setting the graphic of an image control Setting the background color of one or more controls Setting the size of controls Two types of data binding:  Data binding becomes an automatic way of setting any runtimeaccessible property of any control on the form. 1. Simple – a single value within a data set is bound to something such as a property of a control or a form. Any property of a component can be bound to any value in a dataset.
  21. 21. Working with Data Binding Applications 2/2  Example: Binding the Text property of a TextBox control to the LastName column of customer’s DataTable. Dim t As DataTable = DataSet1.Tables(“Suppliers”) Dim Text1 As New TextBox Text1.DataBindings.Add (“Text”, t, “CompanyName”) 2. Complex – means that components are able are able to bind to a dataset. Components that can take advantage of this include the DataGrid control and the ComboBox Control.  Example: Binding a DataTable to a ComboBox Control. Dim t As DataTable = DataSet1.Tables(“Suppliers”) Dim Combo1 As New ComboBox Combo1.DataSource = t Combo1.DisplayMember = “CompanyName”
  22. 22. Creating a Multilingual Applications 1/2  A multilingual application is aware of the operating system’s default local culture installed on the client computer. This enables the application to change the information displayed to the user with buttons and menus depending on their machine setup.
  23. 23. Creating a Multilingual Applications 2/2  Steps to create multilingual forms 1. Design your form based on the default language, including all menus, buttons, text values, and other display elements. Set the Localizable property of the form to true. Select an alternate language from the Language property. Change each control’s text property for the new language. You can also change any other property of the control for each language; this commonly includes the Size property to allow for wider text values in button controls. Repeat steps three and four for each new language. Compile and test your application with your default language. Test other languages by changing the Regional and Language Options from the Control Panel and restarting the application. The new language version should display automatically. 2. 3. 4. 5. 6.
  24. 24. Printing a Line of Text Using the GUI
  25. 25. Flash Card Addition (Finding the Value of Z) 1/2
  26. 26. Flash Card Addition (Finding the Value of Z) 2/2
  27. 27. Temperature Conversion 1/2 Convert Celsius to Fahrenheit Formula: F = (9 / 5) + 32
  28. 28. Temperature Conversion 2/2
  29. 29. Problems 1/2  Using the GUI, write a program that will add, subtract, multiply and divide two integers.
  30. 30. Problems 2/2 Write a program that will show the profile of an athlete.

×