Introduction to vb net
This presentation is the property of its rightful owner.
Sponsored Links
1 / 43

Introduction to VB.NET PowerPoint PPT Presentation


  • 72 Views
  • Uploaded on
  • Presentation posted in: General

Introduction to VB.NET. Tonga Institute of Higher Education. Programming Basics. Program / Application – A set of instructions that a computer uses to do something. Programming / Developing – The act of creating or changing a program Programmer / Developer – A person who makes a program

Download Presentation

Introduction to VB.NET

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Introduction to vb net

Introduction to VB.NET

Tonga Institute of Higher Education


Programming basics

Programming Basics

  • Program / Application – A set of instructions that a computer uses to do something.

  • Programming / Developing – The act of creating or changing a program

  • Programmer / Developer – A person who makes a program

  • Run / Execute – The act of using a program

  • Source Code – Code written in a programming language by a developer.

  • Every program was created by someone

  • Computers use special languages

  • Programmers use special languages to create or change a program


Introduction to visual basic net

Introduction to Visual Basic .Net

  • Visual Basic .Net (VB.Net) is a programming language created by Microsoft.

    • http://msdn.microsoft.com

  • Many programmers use VB.Net

  • VB.Net is an object oriented language.


Impact on visual basic 6 0

Impact on Visual Basic 6.0

  • Visual Basic 6 is old technology

  • Visual Basic 6 will still be used for many years to maintain existing programs

  • The future of Visual Basic development is Visual Basic .NET


Integrated development environments ides

Integrated Development Environments (IDEs)

  • IDEs are programs designed to make programming easier.

    • Graphical Interface is intuitive

    • Program management is easier

    • Source code is easier to read

    • Errors are easier to fix

    • Too many features to list!

  • You do not need an IDE to create a program. But they are very helpful.

  • There are a few different IDE’s for VB.Net. But most VB.Net developers use Visual Studio .Net. (VS.Net)


First look at vs net

First Look at VS.NET

Options you can

look at

Allows you

to customize

your IDE

Different

windows you

can use


Setting up your environment

Setting Up Your Environment

  • You cannot save files to the C Drive

  • You must save files to the P Drive

  • We want to organize our files on the P Drive

    • Use good names

    • Keep related files in the same location

  • To tell VS.Net to use your P Drive

    • Start VS.Net

    • Go to Tools -> Options

    • Go to Environment -> Project and Solutions

    • Change Visual Studio Projects Location to your folder on the P drive. (You may create a new folder if you click the Browse button)

    • Click OK button


Demonstration

Demonstration

Setting up VS.Net


Class exercise

Class Exercise

  • Start VS.Net

  • Setup VS.Net to save to a directory on your P drive


How to make and run a program

How to Make and Run a Program

  • Create a new project

    • Click on Projects tab

    • Click on New Project button

    • Enter “HelloWorld” as the name of the new project.

    • Make sure that the Windows Application template is selected.

    • Click the OK button

  • Start the application

    • Click on Debug -> Start menu item


Demonstration1

Demonstration

How to Make and Run a Program HelloWorld


Class exercise1

Class Exercise

  • Create a Windows Application

  • The name of the Windows Application is HelloWorld

  • Run the program


Solutions and projects

Solutions and Projects

  • Examples of how Solutions and Projects work together

    • Molisi Management Solution

      • Customer Project

      • Financial Project

      • Manager Project

    • Homework 1 Solution

      • Program 1

      • Program 2

    • Homework 8 Solution

      • Big Program

  • Solution – An organizer for projects.

    • A solution can contain many projects

  • Project – An organizer for a program.

    • A project can include many files.


Solutions and projects1

Make sure the

correct item

Is selected

Solutions and Projects

  • To make a new solution, go to File -> New -> Blank Solution

    • A solution can contain many projects

  • To make a new project, go to File -> New -> Project

    • A project can include many files.

  • The same window is used for creating Solutions and Projects


Projects

Make sure your

project is saved

in the correct folder

Can choose to add to the

current solution or create a

new solution

Projects

  • There are many different kinds of project we can make.

  • This class focuses on Windows Applications


Best practices

Best Practices

  • Keep your Solution and Project names simple and descriptive

    • Good Examples: Assignment5, Bank, Customer

    • Bad Examples: ILoveYou, IMissYou, INeedYou

  • Don’t use spaces in your names


Demonstration2

Demonstration

Creating Solutions and Projects


Adding forms to a project

Adding Forms to a Project

  • A form is a window

  • To add forms to a project:

    • Solution Explorer -> Project Name -> Right Click -> Add -> Add Windows Form

    • Enter the name of the new form


Adding projects to a solution

Adding Projects to a Solution

  • To add projects to a solution:

    • Solution Explorer -> Right Click -> Add -> New Project

    • Select the project type

    • Enter the name of the new form


Demonstration3

Demonstration

Adding Forms to a Project and

Adding Projects to a Solution


Setting startup projects

Setting Startup Projects

  • A solution may contain more than 1 project

  • To tell Visual Studio .NET which project should be started when the solution is run:

    • Solution Explorer -> Project Name -> Set as Startup Project


Setting startup objects

Setting Startup Objects

  • Often, your project has more than 1 object that can be started

  • To tell Visual Studio .NET which object should be started when the program is run:

    • Solution Explorer -> Project Name -> Right Click -> Common Properties -> General -> Startup Object


Demonstration4

Demonstration

Selecting a Startup Project and Selecting a Startup Object


Stumbling blocks

Stumbling Blocks

  • You can’t change properties when a program is running

  • If you rename a file, make sure you keep the .vb extension

  • Make sure you’re saving to the P drive


Class exercise2

Class Exercise

  • Create a solution called MyFirstSolution

  • Create 2 projects inside MyFirstSolution

  • Each project will have 2 forms

  • All 4 forms will have different colors

  • Practice Running each different form


Behind the scenes 1

Behind the Scenes - 1

  • All files are stored on the computer

  • The location is determined by your settings

  • 2 Folders exist

    • Bin – Contains the files needed to run the program

      • To give the program to someone else, copy these files to their computer

      • The running the .exe file will begin the program

    • Obj – Contains the files needed to debug (fix) the program

      • These are useful when fixing errors in a program

  • When you start the application this way: Click on Debug -> Start menu item, files are automatically created for you in both folders


Demonstration5

Demonstration

Creating, Deleting and Executing Files Behind the Scenes


Behind the scenes 2

Behind the Scenes - 2

  • All files are stored on the computer

  • The location is determined by your settings

  • Solutions and Projects use different files

    • Solutions

      • <SolutionName>.sln

      • <SolutionName>.suo

    • Projects

      • AssemblyInfo.vb

      • <ProjectName>.vbproj

      • <ProjectName>.vbproj.user

  • The organization of the files is determined by the order that you create the solutions and projects in


Demonstration6

Demonstration

Viewing Solution and Project Files


Behind the scenes 3

Behind the Scenes - 3

  • The organization of the files is determined by the order you create solutions and projects:

  • From a clean start:

    • If a solution is created first, a folder is created

      • The solution’s name is the name of the folder

      • The solution’s files are inside this folder

    • If a project is added to the solution, a folder is created inside of the solution folder

      • The project’s name is the name of the folder

      • The project’s files are inside this folder


Demonstration7

Demonstration

File Organization when Solution is Created First


Behind the scenes 4

Behind the Scenes - 4

  • The organization of the files is determined by the order you create solutions and projects:

  • From a clean start:

    • If a project is created first, a folder is created

      • The project’s name is the name of the folder

      • The project’s files are inside this folder

      • The solution’s files are also inside this folder


Demonstration8

Demonstration

File Organization when Project is Created First


Class activity

Class Activity

  • What will happen for these different solution / project creation scenarios?


Continuing work on a program

Continuing Work on a Program

  • Always open your Solution or Project file.

    • Solution files: .sln

    • Project files: .vbproj

    • Some files depend on other files. If you only open a .vb file, your references may not be correctly setup. Therefore, your application may not work.

  • If you open a project file without a solution file:

    • The solution files are automatically created

    • You will be asked to save the files when you exit VS .Net


Demonstration9

Demonstration

Show how Solution files are automatically created


Vs net windows 1

VS.NET Windows - 1

  • How do we write programs?

    • Write the code

    • Fix any errors

      • Bug - An error in a program

      • Debug – The act of removing errors from a program

  • Many windows are available to help you create code and debug your programs better


Vs net windows 2

VS.NET Windows - 2

  • Solution Explorer

    • Shows all the projects in your solution

    • Shows all the files in each project

  • ToolBox

    • Allows you to add controls to your form

  • Properties

    • Allows you to change object properties

  • Task List

    • Shows all current syntax errors

    • Tracks pending changes and additions to code

      • ‘Todo

    • Right Click on column header and go to Show Tasks to change what is displayed


  • Demonstration10

    Demonstration

    VS.Net Windows


    Managing your windows

    Managing Your Windows

    Docked Windows

    • Windows can dock in different parts of your screen

    • Many windows docked in the same location are organized with tabs

    • The pin allows you to choose whether you want the windows to hide when you are not using them

    • Only show the windows you want to use!

    Tabs


    Demonstration11

    Demonstration

    Managing Windows


    Vs net features

    VS.NET Features

    • Outlining

      • #Region “RegionName”

      • #End Region

    • Intellisense

      • Helps you choose the word you want to type

      • Ctrl + Space

    • Autocode

      • Creates code automatically for you

      • Use ComboBoxes in code view

    • Lines to Separate Methods


    Demonstration12

    Demonstration

    Other VS.Net Features


  • Login