Wednesday, October 2, 2013

TUTORIAL 1: BASIC INPUT AND OUTPUT (USING VB.NET)

Are you ready for a little programming? Well here we are. little2more will help you to kick start the very basic of vb.net programming. The tutorial below will take you step by step on how to create basic and simple program, in my case I'm using VISUAL STUDIO 2010 PROFESSIONAL. Do not worry if you are using other version of VISUAL STUDIO. Basically the code and concept are same although the GUI look different. I advise you to do this small project tutorial then later we go deeper into this topic.

BASIC INPUT AND OUTPUT


Step 1: Start your Microsoft Visual Studio. As previously mentioned, I'm using Microsoft Visual Studio 2010 Professional.

Step 2: Go to File menu>Project(at the top left your running program).

Step 3: Choose console and type meaningful project name (example ConsoleLittle2More_1). We use console application in first tutorial for some reason. We will discuss about it later.

Step 4: Here is your first look of 'paper'. Imagine it as a blank paper. What actually happen here is The IDE(integrated development environment) generate starting point code. Now it is your job to write vb.net code.

Step 5: Write your very first code. In the Sub Main procedure write the code below:-
Console.Writeline("Hello World")
Console.Readkey()

Step 6: Click debug button and get your very first output.

Step 7:Differences between using writeline and write function. Write code below and click save button.
Then Click debug button.

Comment your Console.Readline() code line (use symbol ' to comment your code).
Write new code:-
Console.Write("Little to More")
Console.Readkey()

Differences output between two function Writeline and Write.

What are we actually doing? If you're finished tutorial above you actually write a program. You are way to be a programmer.
Let's get to know the codes and the program.
Console Application
Why are we using console application in this tutorial? Well there are some reason we start with console application.
Console application is a basic application. There is no interface or graphic in console application.
This application might be bored for certain people, but it is helpful to get to know what exactly you do for the code.
The code you have written above are about:-

Console is a class.
To create console program, we must use this class called console.

Console.Writeline() is a method.
To write text or value into the program, we need to write this line of code.

Console.Write() is a method.
It is works same as Console.Writeline() but the different is the cursor placed at the same line with the text we write(output).

Console.Readkey() is a method.
This method allows program to wait until get the key pressed function from keyboard from user.

We write the text or value with double quote " " inside the Writeline() bracket. In the example above, we write "Hello World" and "Little to More" as a value.
These two string are the values and they are output for this program.

These lines of code are generated by GUI of Microsoft Visual Studio.

Sub Main()
.......
End Sub
is a main procedure which is work as startup code.
Microsoft Visual Studio GUI generate this startup code once we create a project.
This is starting point. Every code you write will be in this Main () and the code will end before End Sub.


Module Module1()
.......
End Module
This is the beginning of your program.
It tells our machine about the codes that we gonna to write.
It is end with keyword End Module.

To master in programming we need a great deal of experience; read about it and work with it, ask other experienced programmers or read other people's code. There are many ways and long journey to become a master. This is only the beginning. Let's not give up before we even get started.

No comments:

Post a Comment