Download presentation
Presentation is loading. Please wait.
Published byCassandra Walsh Modified over 9 years ago
1
Visual Basic.Net
2
Software to Install Visual Studio 2005 Professional Edition (Requires Windows XP Pro) MSDN Library for Visual Studio 2005 Available from MSDNAA
3
What is Visual Basic.Net 4 th Generation Programming Environment / Development Language Based on BASIC language Beginners All-Purpose Symbolic Instructional Code Most widely used tool for developing Windows Applications Graphical User Interface (GUI) Menus, Buttons, Icons to help the user Full Object-Oriented Programming Language
4
Visual Studio.NET A platform that allows the development and deployment of desktop and web applications Allows user choice of many.NET languages May program in One of them May create different parts of application in different languages Visual Basic C# (C Sharp) C++ J++ Etc.
5
Visual Studio.NET Integrated Development Environment – allows the automation of many of the common programming tasks in one environment Writing the code Checking for Syntax (Language) errors Compiling and Interpreting(Transferring to computer language) Debugging (Fixing Run-time or Logic Errors) Running the Application
6
Using Visual Studio.NET
7
Creating an Application Select the “Create Project” option from the “Recent Projects” box on the Start Page
8
Default Settings
9
Design Window ToolboxToolbox Solution Explorer Properties Window
10
Creating the Application Step 1: Add a Control to the Form Add a Button to the Form Look in the Toolbox for the Button Control Select the Button with the Mouse Draw a Rectangle Region in the Design Window by holding the mouse button down Release the mouse button to see your button (Can also be added by double clicking on the button in the Toolbox)
12
Creating the Application Add a Second Button to the Form Put it in the lower right corner The project now contains a form with 2 button controls
13
Setting Control Properties Properties Determine the Look and Feel (and sometimes behavior) of a Control Set through the Properties Window Properties Set for this Application Name Text
14
Setting Control Properties Click on the Control in the Design Window Select the appropriate property in the Properties Window
15
Control Name Should be Meaningful NOT button1, form1, textbox1 Should begin with a 3 character prefix Button btn Label lbl Textbox txt Set the name of button1 to btnWelcome Set the name of button2 to btnExit
16
Text Property Determines the visible text on the control Change the text property bntWelcome set to “Say Welcome” btnExit set to “Exit” Do not need to include the “ “ in your text field Notice how the buttons now display the new text
17
Add the Code To Make the GUI Functional Open the Code Editor F7 Select View Menu then Code option Double Click on the Control you are writing the code for
19
Comments Provide Documentation & Explanations Begin with a ‘ (followed by an * for readability)
20
Event Code (Procedures) GUI programs are Event Driven Event Procedures respond to events Writing an Event Procedure Double click on control from Design Window Select Control & Event from drop down windows in Code Editor
21
Select the Control for the Event Procedure Select the btnWelcome control from the Form Controls List Box
22
Select the Event for the Event Procedure Select the Click event from the list of many available events Buttons have 57 possible events they can respond to
23
Event Procedure Stub Beginning of Procedure is created for you If you create stub by double clicking on control it will create a stub for the most commonly used event
24
Event Procedure Write the code that you want executed when the user clicks on the btnWelcome button Type: MsgBox (“Welcome to Visual Basic”) Must be contained within the Event Procedure Stub
25
Writing Visual Basic Code Not Case Sensitive Visual Basic will “correct” case issues for you Keywords are in Blue Special reserved words Comments in Green Problems with Syntax (Language) will be underlined in blue
26
Create an Event Procedure Create an Event Procedure for the btnExit button Have it display “Goodbye” in a MsgBox Then “End” – this will terminate the program
27
Switching to Design Window You can switch between the Design Window and the Code Window (once opened) by clicking on the tabs at the top of the Design and Code Windows Form1.vb(Design) is the design window Form1.vb is the Code Window
28
Running the Application Click the Run Icon on the Standard Toolbar Press F5 This will begin the program Display the Form/Window Nothing will happen Waiting on an Event
29
Event Driven Program Click on the “Say Welcome” button The message box should display Click on the “Exit” button The message box should display The application should terminate
30
Save the Project Make sure to save your work SAVE ALL (not Save Form) Visual Basic applications are made of several files - Often even several forms
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.