Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,148,903 members, 7,802,929 topics. Date: Saturday, 20 April 2024 at 03:51 AM

Introduction To Programming Using Microsoft Visual Basic – Tutorial 01. - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Introduction To Programming Using Microsoft Visual Basic – Tutorial 01. (1078 Views)

Learn The Fundamental Of Programming Using The Zoom App. / Learn Python- Introduction To Programming / Introduction To Programming Using Microsoft Visual Basic – Tutorial 2. (2) (3) (4)

(1) (Reply)

Introduction To Programming Using Microsoft Visual Basic – Tutorial 01. by binoosmart(m): 1:39pm On Mar 26, 2017
Objectives:

Know how to locate and open Microsoft Visual Studio IDE from within your computer
Familiarizing yourself with the Visual Studio IDE interface
Learn how to create and run simple console application in Visual Basic directly from Visual Studio IDE and Command line

How To Locate and Open/Run Microsoft Visual Studio IDE
Microsoft Visual Studio is an Integrated Development Environment (IDE) for creating, running and debugging programs (applications) written in a variety of supported programming languages (in this case, Visual Basic). An IDE is a way of bringing together a suite of tools that makes developing software a lot easier.

There are various ways to start Microsoft Visual Studio depending on your system configuration. Locate and fire up your Visual Studio IDE and see what you have got:

From Start Menu: Select Start > All Programs > Microsoft Visual Studio 2010 >Microsoft Visual Studio 2010
[center][img]https://4.bp..com/-2M23Lrtj_TM/WNeuUkWsNGI/AAAAAAAAEXo/hsgAR9VX9nQNS6wf42qDRaUNAW-WbOKuwCK4B/s640/5.png[/img][/center]


From Desktop: If a shortcut labelled Microsoft Visual Studio 2010 exist on the desktop, double click on it to start the application.

Once the Visual Studio IDE begins execution, the Start Page displays. You’ll probably see a screen similar to the one below:
[img]https://1.bp..com/-sfldpkkptzU/WNeuzAS7JEI/AAAAAAAAEXw/e0DQHPyU6CAn-KkzzDOR_wEaMmo4tkEjgCK4B/s640/5.png[/img]

The Start Page has a place for recent projects you’ve had open. From here, you could click on a recent project to open it or select a new project and start from scratch. The Start Page also has online help and some tutorials available just by clicking on the appropriate option. Feel free to look at them when you have time. By default the Start Page opens every time you start Visual Studio.
Menus and Toolbars Of Microsoft Visual Basic.
As explained earlier, an IDE (e.g. Visual Studio) is a collection of tools that makes programming easier. Developers (like you) make use of these tools during software development by executing some commands. These commands are grouped into menus.

In Microsoft Visual Studio, menus are located in the menu bar. Each menu in the menu bar contains a collection of related commands. The Visual Studio menu bar is also dynamic, which means the set of menus displayed depends on what you are currently doing in the IDE.

[img]https://1.bp..com/-H6U4utzCqJc/WNevCm6ZiZI/AAAAAAAAEX8/u-etWtLh03kQXGvMhv0N4dBVBRUiSHh_wCK4B/s640/5.png[/img]

Instead of navigating through series of menus to locate a command, Visual Studio provides quick access to frequently used commands via the toolbar which contains icons that represent commands. You may be familiar with some of these icons in other windows application like Microsoft Word. The toolbar is also dynamic in the sense that icons become active based on what you are currently doing.

Creating Your First Console Application In Microsoft Visual Basic.
To finish your exploration of the Visual Studio IDE, you need to create an application so that the windows shown earlier have some interesting content for you to look at.

In Visual Basic, you create an application by developing a project. The project is stored in a folder and contains files and other folders. The finished executable program is stored in the bin folder which is located in the project folder and has an .exe extension.
Steps:

Select File > New Project… to display the New Project dialog. Alternatively you can click on the New Project icon on the toolbar or use the keyboard shortcut Ctrl+Shift+N

[img]https://3.bp..com/-pH8IINZpCnk/WNevZ27edTI/AAAAAAAAEYE/ERZWPWASZ_EpQnJqzFXH3qMvIBBeIlrewCK4B/s640/Creating%2BYour%2BFirst%2BConsole%2BApplication.png[/img]

[img]http://2.bp..com/-689Uq0pDeSQ/WNevmorOUvI/AAAAAAAAEYM/-tFBemeWy00IuX-FGgZpWxqezFeBmd8GwCK4B/s1600/Creating%2BYour%2BFirst%2BConsole%2BApplication.png[/img]


From the Installed Templates: section, select Windows if it is not selected.
From the Templates: section, select Console Application if it is not selected.
In the Name: field type “Welcome” as shown in the figure above.
Click on the Ok button.

Having done with that, you get a window similar to this:

[img]https://1.bp..com/-tLsFIrZxQws/WNev1eGmmsI/AAAAAAAAEYU/eTfPXhm-XvYiesOgF57_d4Y9tkbkdlB_wCK4B/s640/Creating%2BYour%2BFirst%2BConsole%2BApplication3.png[/img]

At this point, you can see that various windows in the IDE are beginning to show their purposes. An example is the Solution Explorer. The Solution Explorer displays the folder structure of your projects located within a Solution. A solution can have one or more projects and projects are made up of entities like Classes, Modules, Forms, images, etc.

By default, Visual Studio IDE creates a module called Module1 whenever you create a new project.

A module is just a logical collection of methods – methods perform a task and may return a value when the task is completed.

Every Visual basic code is stored in a file that ends with .vb extension. From Solution Explorer you can see that Module1 Module is stored in a file called Module1.vb. This name is not descriptive. So let’s rename the file to WelcomeModule.vb.

On the Solution Explorer window, Click on Module1.vb.

Notice the changes in the Properties Window. The Properties window displays information about currently selected item in the Solution Explorer or Design Window.

On the Properties Window Change the File Name property to WelcomeModule.vb.
Press Enter key from your keyboard. Notice that the Module name in the code also changed to reflect the file name.

Few notes on Visual Basic syntax
A keyword is a reserved word in the Visual Basic language. Keywords are used to perform a specific task in the computer program. E.g. Dim, Rem, If, Else, End, Sub

Comments are used by programmers to clarify the source code. All comments in Visual Basic follow either the ' character or the Rem keyword. Comments are ignored by the Visual Basic compiler.


Recommended: Some HTML Tags And Their Definition (With Example)
http://icict..com/2017/03/some-html-tags-and-their-definition.html


White space in Visual Basic is used to separate tokens in the source file. It is used to improve readability of the source code. The amount of space put between tokens is irrelevant for the Visual Basic compiler.

A statement in Visual Basic is a complete instruction. A statement can be used for declaration or to initiate actions.

A line continuation character ( _ ), is used if a statement spans more than one line otherwise compilation will fail.

Modifying WelcomeModule.vb code

Click on WelcomeModule.vb tab to view the editor window
In between Sub Main() and End Sub , type

Console.WriteLine(“Welcome to Visual Basic Programming!”)
or
console.write(“Welcome to Visual Basic Programming!”)

Saving your project

Save your project by selecting File > Save All on the toolbar or by using the keyboard shortcut Ctrl+Shift+S. For the first time, the Save Project Window appears.

[img]https://lh5.googleusercontent.com/7srBwbay2GrZKyAcDsfmEdbFsCHp-Taaa-cDeYpli2AfPPfw_S81yh6RCNe-PetMTAANioFkS9LFsAKVKIgcKq5ZdCiwhF5H9noAoecxr3Otj0iOYNfXG-9sZzaAI2WnU5UPMpo0rOubwOJxag[/img]


On the Location: field, type in the address. The format should be:

C:\VBPracticalProjects\<<your name>>
where <<your name>> will be replaced by your name. For example,
C:\VBPracticalProjects\Binoosmart
All subsequent practical exercises should be located in that folder.

In the Solution Name, type in Tutorial01 since this is Tutorial01 of the tutorial practical. If you were on Tutorial02 the Solution Name will be Tutorial02 and so on.
Make sure the Create directory for solution is checked.
Click on Save button.

Running your first console application in Microsoft Visual Basic
You are now ready to compile and execute your application.
To compile the application:

On the menu bar, select Build > Build Welcome. This creates a file called Welcome.exe in C:\VBPracticalProjects\Binoosmart\Part01\Welcome\bin\Release or C:\VBPracticalProjects\Binoosmart\Part01\Welcome\bin\Debug depending on your IDE configuration.

To execute the application:

From the IDE select Debug > Start Without Debugging or use the keyboard shortcut Ctrl+F5.
From windows command prompt, use cd command to navigate to the folder where Welcome.exe file is located in your project.
Type the name of the .exe file. In this case, Welcome.exe.
Press Enter key from the keyboard.

i think this help newbies
i publish exercises on this tutorial and the solutions you can check it out here : http://icict..com.ng/2017/03/introduction-to-programming-using.html
Re: Introduction To Programming Using Microsoft Visual Basic – Tutorial 01. by binoosmart(m): 1:45pm On Mar 26, 2017
Re: Introduction To Programming Using Microsoft Visual Basic – Tutorial 01. by Bros1: 6:19pm On Mar 27, 2017
This is very good. Please keep publishing more.

Are you very good at VB.net? If yes please let's talk.

Whatsapp: O&O3SI33SZZ

(1) (Reply)

Is There A Way I Can Get The Dummy API For Our Local Nigeria Flights? / How Much Will Ot Cost Me To Develop My Website App / Nigerian Hacker Under 20 Years Hacked More Than 4000 Companies

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 24
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.