Introduction to Programming or Introduction to Visual Basic is a program run in IYA ABUBAKAR COMPUTER CENTER in AHMADU BELLO UNIVERSITY and I am giving to you now the very first tutorial on this subject but first I conclude that by now you should have been familiar with what Programming or Visual Basic Programming Software is but if you are not familiar with it I got you covered I explained every thing in details below. But first I will be starting with:
- 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
- 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:
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.
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.
- 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:
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.
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.
- 10 Courses You Need To Know About If You Want A Career In Computer Science Or Engineering. (For Beginners)
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!”)
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.
- On the Location: field, type in the address. The format should be:
where <<your name>> will be replaced by your name. For example,
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.
Exercises For You, To Test What You Just Learn The Solution Is Below It.
- What is the difference between Console.WriteLine() and Console.Write() methods?
- Modify the Welcome project so that it displays the following text in one line.
“Welcome to Visual Basic programming using Microsoft Visual Studio Integrated Development Environment!”
- Write an application (MyProfile) that displays your profile. An example output is displayed below. The output of the application should correspond to you.
Phone No.: +2348168374589
Name: Yakubu Binuyaminu
State: Kogi State
Save and run the Project as MyProfile under Tutorial01 Solution.
- Write an application that will output something similar to the output in the figure below:
Save the application as VShape under Tutorial01 Solution. (Hint: use spaces to separate the asterisks).
When you are done, Tutorial01 Solution should contain three projects namely:
- MyProfile, and
- The Basic difference between Console.WriteLine() and Console.Write() methods is that Console.WriteLine() will make each sentence or the item you want to display in be on a separate lines, each will have their lines. While the Console.Write() method is otherwise every statements been display by this method will bring out or display all output in one line. I think that English is Simple enough.
- Sub Main ()console.write(“Welcome to Visual Basic programming using Microsoft Visual Studio Integrated Development Environment!”)End SubEnd Module
- Sub Main ()console.writeline(“Phone No.: +2348168374589”)console.writeline(“Name: Yakubu Binuyaminu”)console.writeline(“Sex: Male”)console.writeline(“Country: Nigeria”)console.writeline(“State: Kogi State”)console.writeline(“Religion: Islam”)End SubEnd Module
- Sub Main ()console.writeline(“* *”)console.writeline(“ * *”)console.writeline(“ * *”)console.writeline(“ * *”)console.writeline(“ *”)End SubEnd ModuleWatch out for the Tutorial 2 so that you wouldn't miss future tutorials like this one please subscribe with your Email. And keep coming back.Alright thanks for reading please if you like this tutorial share with your friends and don't hesitate to ask me any question in the comment section.
List Of the Tutorials: