Presentation is loading. Please wait.

Presentation is loading. Please wait.

Overview of the IDE Visual Studio .NET is Microsoft’s Integrated Development Environment (IDE) for creating, running and debugging programs (also.

Similar presentations


Presentation on theme: "Overview of the IDE Visual Studio .NET is Microsoft’s Integrated Development Environment (IDE) for creating, running and debugging programs (also."— Presentation transcript:

1 Overview of the IDE Visual Studio .NET is Microsoft’s Integrated Development Environment (IDE) for creating, running and debugging programs (also called applications) written in a variety of .NET programming languages.

2 Starting Page When Visual Basic is launched, the startup page is displayed. This page is divided into left and right panes. The left pane contains buttons which are used to open an existing project (such as the ones in the table of recent projects) and to create a new project, respectively

3 CREATING A NEW PROJECT To create a new Visual Basic program, click the New Project button or choose File, New then Project which displays the New Project dialog. Dialogs are windows that facilitate user-computer communication.

4 The Visual Studio .NET IDE organizes programs into projects and solutions, which contain one or more projects. Multiple-project solutions are used to create large-scale applications in which each project performs a single, well- defined task. The Visual Studio .NET IDE provides project types for a variety of programming languages. We will be focusing on Visual Basic Programming Language.

5 Visual Basic allows you to create Graphical User Interface GUI) applications and Command Line applications. By default, the Visual Studio .NET IDE assigns the name WindowsApplication1 to the new project and solution. The Visual Studio Projects folder in the My Documents folder is the default folder referenced when Visual Studio .NET is executed for the first time

6 Menu Bar and Toolbar Commands for managing the IDE and for developing, maintaining and executing programs are contained in the menus, which are located on the menu bar. Menus contain groups of related commands (also called menu items) that, when selected, cause the IDE to perform specific actions.

7 Menu Description File Contains commands for opening projects, closing projects, printing project data, etc. Edit Contains commands such as cut, paste, find, undo, etc. View Contains commands for displaying IDE windows and toolbars. Project Contains commands for managing a project and its files. Build Contains commands for compiling a program. Debug Contains commands for debugging (i.e., identifying and correcting problems in a program) and running a program. Data Contains commands for interacting with databases. Format Contains commands for arranging a form’s controls. Tools Contains commands for accessing additional IDE tools and options that enable customization of the IDE. Windows Contains commands for arranging and displaying windows. Help Contains commands for accessing the IDE’s help features.

8 Solution Explorer The Solution Explorer window provides access to all the files in the solution. When the Visual Studio .NET IDE is first loaded, the Solution Explorer is empty; there are no files to display. Once a solution is open, the Solution Explorer displays that solution’s contents.

9 Toolbox The Toolbox contains controls used to customize forms. Using visual programming, programmers can “drag and drop” controls onto the form instead of building them by writing code. Just as people do not need to know how to build an engine to drive a car, programmers do not need to know how to build a control to use the control.

10 Properties Window The Properties window displays the properties for a form or control. If the Properties window is not visible, selecting View > Properties Window, displays the Properties window. Properties specify information such as size, color and position. Each form or control has its own set of properties; a property’s description is displayed at the bottom of the Properties window whenever that property is selected.

11 Visual Basic Programming
Visual Basic .Net has Console application and Graphics Application, we are going to talk about the Graphical User Interface Part (Windows Forms Application). A graphical user interface (GUI) allows a user to interact visually with a program GUIs are built from GUI components (which are sometimes called controls or widgets—short for window gadgets).

12 Control Description Label An area in which icons or uneditable text is displayed. Textbox An area in which the user inputs data from the keyboard. This area also can display information Button An area that triggers an event when clicked CheckBox A component that is either selected or unselected ComboBox A drop-down list of items from which the user can make a selection either by clicking an item in the list or by typing into a box ListBox An area in which a list of items is displayed. The user can make a selection from the list by clicking on any item. Multiple elements can be selected Panel A container in which components can be placed Scrollbar A component that allows the user to access a range of elements that normally cannot fit in the control’s container

13 Windows Form Windows Forms (also called WinForms) are used to create the GUIs for programs. A form is a graphical element that appears on the desktop; it can be a dialog, a window or an MDI window (multiple document interface window). In Windows Forms Application, Visual Studio has 2 views, namely, Design View and Code View. You will be taken by default to the design view when a new project is created, where modifications can be done without writing any code. The toolbox at the left of the window helps to add controls to the form. To add any control to the form, just click on that control and draw in on the form (Window).

14 EXERCISE Start a new project Add label from the toolbox
Name it name=lblOutput the Text property to "Click Me!".

15 Design and Code View We have been working in Design mode, which provides a graphical representation of our program However, Visual Studio .NET has been creating code in the background, and that code can be accessed using the tab for the code or by right-clicking anywhere in the Design window and selecting View Code The size of the window can be changed in the properties window or by dragging the anchors around the window To run the application, press F5 or click on the play button on the toolbar. To stop the application hit the stop button or close the application window

16 To define and register an event handler for lblOutput, the IDE must be displaying the code listing for the Window application. The drop-down menu on the left-hand side, called the Project Name, contains a list of all projects in the solution. The middle drop-down menu, called the Class Name menu, contains a list of all controls and components contained in our Form. On the right-hand side, the Method Name drop-down menu allows the programmer to access, modify and create event handlers for controls and components.

17 For the purposes of this exercise, we want the label to respond when clicked.
Select the Click event in the Method Name drop-down menu. This creates an empty event handler inside the program code. (Alternatively, we could have double-clicked on the label in the Design mode to generate the click event for the label. Private Sub lblOutput_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblOutput.Click End Sub This is the method that is called when the form is clicked. We program the form to respond to the event by displaying a message box. To do this, insert the statement MessageBox.Show("Label was clicked.") into the event handler

18 Understanding Buttons, and Textboxes
Create a new Windows Forms Application and set its name to Calculator. Change the form’s text property to My Calculator From the ToolBox, drop a TextBox control onto the form, and resize it. Change the text name to LCD Set text property number to 0 Search for the TextAlign property and choose right Simply change the ReadOnly property to True Go to the BackColor property of the text box and select the white color for it. Next, From the tool box window, drag and drop a Button onto the form. Change its Name property to n1 change the text property into 1 Repeat the operation again for all the numbers by adding the buttons n2- n9, n0 (2-9,0)

19 Now if you run the application, you won’t be able to do anything, i. e
Now if you run the application, you won’t be able to do anything, i.e. the form appears, and pressing the buttons will have no effect. This is because we haven’t told the application what to do when you click any of the buttons. So, double click the button n1 to go to its event. Private Sub n1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles n1.Click LCD.Text = LCD.Text & "1" End Sub The code means the following: What you see here is a procedure or subroutine. This is a small block of code that you write to tell the application what to do when a button is clicked

20 The n1_Click is the name of this procedure
The n1_Click is the name of this procedure. It tells the program what to execute when the button whose name is n1 is clicked by the user. Private Sub part defines the subroutine. It is part of the language (or keywords as they call it). n1_Click is the name of that subroutine. (ByVal sender As System.Object, ByVal e As System.EventArgs) : these are called the arguments. They allow the subroutine to be flexible by checking some inputs, to process things differently. More on that later. Handles n1.Click : this one means that this subroutine will be automatically called whenever the button n1 is clicked by the end user.

21 LCD.Text = LCD.Text & "1" : this is the processing we are performing when we press the button 1. Its means, add to the current text on the display (which we call LCD) the number 1. End Sub : signals the end of subroutine You should repeat the code for buttons n2, n3, n4, n5, n6, n7, n8, n9, and n0 to add the numbers 2,3,4,5,6,7,8,9,0 respectively Next, we create the clear button, copy the 0 button, and place the copy next to the 0. Change its name to bc, and text property to C. Double click on the C button (does same as 0) Now add the other controls as shown below. Next name them as follows: + name is badd - name is bsub * name is bmult / name is bdiv = name is bequal

22 Double click the + button to go to the code window
Double click the + button to go to the code window. Now add the code: Dim FirstNumber As Long Dim Operation As String FirstNumber = LCD.Text LCD.Text = "0" Operation = "+" REPEAT FOR -*/ The last thing to do is the = handler where the operation should be executed Dim SecondNumber As Long Dim Result As Long SecondNumber = LCD.Text If Operation = "+" Then Result = FirstNumber + SecondNumber ElseIf………..Then ……………. Continue End If FirstNumber = Result LCD.Text = Result


Download ppt "Overview of the IDE Visual Studio .NET is Microsoft’s Integrated Development Environment (IDE) for creating, running and debugging programs (also."

Similar presentations


Ads by Google