BS(CS) 5th M.Mohsin
Visual programming • Visual programming is a way of creating software applications without writing code. It's a graphical representation of how different components interact, allowing developers to create complex programs quickly and easily.
4 Basic Parts of visual Basic • Procedures, operators, properties, and events are the only programming elements that can hold executable code
Basic Syntax • Object: Objects have behaviors and states. An object is a class instance. • Class: A class is a template that outlines the behaviors/states that objects of its type can support. • Method: A method is essentially a behavior. Many methods can be found in a class. Methods are where logic is expressed, data is manipulated, and all actions are carried out. • Instance Variables: Each object has a collection of instance variables that are unique to it. The values assigned to these instance variables define an object's state.
Contents  Introduction – Visual Studio 2012  Start Page  Create a New Project  Forms.cs  Solution Explorer  Toolbox  Properties Window  Project Physical Folder  Run the Project 5
Introduction – Visual Studio 2012  Visual Studio 2012 is Microsoft’s Integrated Development Environment (IDE) for creating, running and debugging apps (also called applications) written in various .NET programming languages. 6
Start Page 7
Create a New Project  Start Page  New Project Or  File  New  Project A Project: is a group of related files, such as the Visual C# code and any images that might make up an app. 8
Create a New Project 9
Create a New Project  Make sure to choose the proper language “Visual C#”.  And from the templates displayed, choose “Windows Forms Applications”  This template will enable you to start your project with the first screen that will be displayed to the users of the resulted application. This form (window) will be filled with controls that can be used by the user.  Give a name of your project, specify its location on your PC, and finally give a name to the solution. For beginners, we use the same name of the project. 10
Create a New Project  A Solution: contains several projects, and it is usually used for large systems.  In this course, we will create only one project in a solution.  Now, Press “OK” 11
A Project “Start” is created 12
Forms.cs  Form1.cs [Design] This window displays the file form1.cs in design mode. In this window you can add the needed controls to the form. Your project may contain several forms that act as the windows of the application. 13
Solution Explorer  Solution Explorer is used to review all files in your project. Mainly, the form1.cs file, references, and any images you include in the project. 14
Toolbox  Toolbox: is a window that contains all the controls and components that you can add and use in a form.  The controls are categorized in several categories. 15
Toolbox  Common Controls: is the most used categories, since it contains the most common controls that you can find in most forms. For example, buttons and textboxes.  To add any control from the toolbox to the form, drag and drop the control to the desired location, or double click on it, and it will be placed in a location automatically selected by the system. 16
Toolbox  This image displays a form after adding a button to it. 17
Properties Window  The Properties window, displays all properties associated to the selected control.  You can see at the top of this window, in the image, that these are the properties of Form1. 18
Properties Window  Here, Form1 is selected (check the selection handlers), so the properties displayed are associated to the form. 19
Properties Window  Here, button1 is selected, so button1 properties are displayed in the window. 20
Properties Window  Here, textBox1 is selected, so textBox1 properties are displayed in the window.  Note that there are some properties are common with the button properties, and others are special for the textbox. 21
Properties Window  You can display the properties of any control, either alphabetically, as in the first image, or categorized as in the second image. 22
Properties Window  Note that each property has a name and a value of a certain data type. For example, property named “Text”, has a string value of “button1”, a property named “TabIndex”, has an integer value of “0” and a property named “Visible” has a boolean value of “True”. 23
Properties Window  The same property window can be used to display the events associated to a control.  The concept of Events will be discussed in Chapter 2. 24
Project Physical Folder  When the project is created, a physical folder is created with the same project name in the selected location, and all files listed in the Solution Explorer, can be found there. 25
Run the Project  Click on “Start” button, at the toolbar in Visual Studio Window, and an execution file will be generated of the project, and it will be executed as displayed in the image. 26
Run the Project  Go to the Project folder, from bin  Debug, you can find the execution file projectname.exe (start.exe), when you double click the file the project will be distributed, even if the Visual Studio IDE is closed. 27
The End 28

Visual programming basic.ppt bs cs5th class

  • 1.
  • 2.
    Visual programming • Visualprogramming is a way of creating software applications without writing code. It's a graphical representation of how different components interact, allowing developers to create complex programs quickly and easily.
  • 3.
    4 Basic Partsof visual Basic • Procedures, operators, properties, and events are the only programming elements that can hold executable code
  • 4.
    Basic Syntax • Object:Objects have behaviors and states. An object is a class instance. • Class: A class is a template that outlines the behaviors/states that objects of its type can support. • Method: A method is essentially a behavior. Many methods can be found in a class. Methods are where logic is expressed, data is manipulated, and all actions are carried out. • Instance Variables: Each object has a collection of instance variables that are unique to it. The values assigned to these instance variables define an object's state.
  • 5.
    Contents  Introduction –Visual Studio 2012  Start Page  Create a New Project  Forms.cs  Solution Explorer  Toolbox  Properties Window  Project Physical Folder  Run the Project 5
  • 6.
    Introduction – VisualStudio 2012  Visual Studio 2012 is Microsoft’s Integrated Development Environment (IDE) for creating, running and debugging apps (also called applications) written in various .NET programming languages. 6
  • 7.
  • 8.
    Create a NewProject  Start Page  New Project Or  File  New  Project A Project: is a group of related files, such as the Visual C# code and any images that might make up an app. 8
  • 9.
    Create a NewProject 9
  • 10.
    Create a NewProject  Make sure to choose the proper language “Visual C#”.  And from the templates displayed, choose “Windows Forms Applications”  This template will enable you to start your project with the first screen that will be displayed to the users of the resulted application. This form (window) will be filled with controls that can be used by the user.  Give a name of your project, specify its location on your PC, and finally give a name to the solution. For beginners, we use the same name of the project. 10
  • 11.
    Create a NewProject  A Solution: contains several projects, and it is usually used for large systems.  In this course, we will create only one project in a solution.  Now, Press “OK” 11
  • 12.
    A Project “Start”is created 12
  • 13.
    Forms.cs  Form1.cs [Design] Thiswindow displays the file form1.cs in design mode. In this window you can add the needed controls to the form. Your project may contain several forms that act as the windows of the application. 13
  • 14.
    Solution Explorer  SolutionExplorer is used to review all files in your project. Mainly, the form1.cs file, references, and any images you include in the project. 14
  • 15.
    Toolbox  Toolbox: isa window that contains all the controls and components that you can add and use in a form.  The controls are categorized in several categories. 15
  • 16.
    Toolbox  Common Controls:is the most used categories, since it contains the most common controls that you can find in most forms. For example, buttons and textboxes.  To add any control from the toolbox to the form, drag and drop the control to the desired location, or double click on it, and it will be placed in a location automatically selected by the system. 16
  • 17.
    Toolbox  This imagedisplays a form after adding a button to it. 17
  • 18.
    Properties Window  TheProperties window, displays all properties associated to the selected control.  You can see at the top of this window, in the image, that these are the properties of Form1. 18
  • 19.
    Properties Window  Here,Form1 is selected (check the selection handlers), so the properties displayed are associated to the form. 19
  • 20.
    Properties Window  Here,button1 is selected, so button1 properties are displayed in the window. 20
  • 21.
    Properties Window  Here,textBox1 is selected, so textBox1 properties are displayed in the window.  Note that there are some properties are common with the button properties, and others are special for the textbox. 21
  • 22.
    Properties Window  Youcan display the properties of any control, either alphabetically, as in the first image, or categorized as in the second image. 22
  • 23.
    Properties Window  Notethat each property has a name and a value of a certain data type. For example, property named “Text”, has a string value of “button1”, a property named “TabIndex”, has an integer value of “0” and a property named “Visible” has a boolean value of “True”. 23
  • 24.
    Properties Window  Thesame property window can be used to display the events associated to a control.  The concept of Events will be discussed in Chapter 2. 24
  • 25.
    Project Physical Folder When the project is created, a physical folder is created with the same project name in the selected location, and all files listed in the Solution Explorer, can be found there. 25
  • 26.
    Run the Project Click on “Start” button, at the toolbar in Visual Studio Window, and an execution file will be generated of the project, and it will be executed as displayed in the image. 26
  • 27.
    Run the Project Go to the Project folder, from bin  Debug, you can find the execution file projectname.exe (start.exe), when you double click the file the project will be distributed, even if the Visual Studio IDE is closed. 27
  • 28.