Begginer Guide & Introduction of VB
Written by Soul Collector
Hello everyone.
This is my VB .NET tutoria about basics. This is tutorial is made for everyone who want start programming in VB .NET and dont know where to go. I writed it but i used something from net (almost everything i writed), so if you share it on other forums,websites or blogs give a credits to me.
1.
Downloading VB .NET
First of all to download a Visual Basic 2008 visit Microsoft's home page (
Microsoft Visual Studio Express - Build cutting edge Windows applications). There you should find Visual Basic downloading client.
Download it, and run vbsetup.exe. The downloading client should pop up (around 100 mb). It will take few minutes depends on internet connection speed.
2.
Starting VB. NET
After you download and install Visual Basic 2008 run Visual Basic 2008. Now we gonna learn more about Visual Basic [b]applications and features.
What is Visual Basic?
It's a computer programming system developed and owned by Microsoft. Visual Basic was originally created to make it easier to write programs for the Windows computer operating system. The basis of Visual Basic is an earlier programming language called BASIC that was invented by Dartmouth College professors John Kemeny and Thomas Kurtz. Visual Basic is often referred to using just the initials, VB. Visual Basic is easily the most widely used computer programming system in the history of software.
History of Visual Basic
Microsoft first released Visual Basic in 1987. It was the first visual development tool from Microsoft, and it was to compete with C, C++, Pascal and other well-known programming languages. From the start, Visual Basic wasn't a hit. It wasn't until release 2.0 that people really discovered the potential of the language, and with release 3.0 it had become the fastest-growing programming language on the market.
Below is the order and the approximate year in which a new version of Visual Basic was released:
1991, VB1 Debuts
1992, VB2 Debuts
1993, VB3 Debut
1996, VB4 Debuts
1997, VB5 Debuts
1998, VB6 Debuts
2001, VB. NET Debuts
3.
Making Basic Software with VB .NET
Windows application
Programs are EXE files for DOS and Windows systems. An EXE file is an executable file, which is a file in a format that the computer can directly execute and are not easily read by humans. Executable files for Windows and DOS systems have an.EXE extension.
Class library
Include function which can be used in built Console Application's and Windows Application's.
Console application
Is a computer program designed to be used via a text-only computer interface, such as a text terminal, the command line interface of some operating systems (Unix, DOS, etc.) or the text-based interface included with some Graphical User Interface (GUI)
Now when you know what type of program you can make, soon we will start making one. That will be basic program "Hello World" which will show word "Hello World".
Windows Application
1. Click File - Add - New Project
2. Choose Windows Application
3. Write in name bar "Hello World" (Wihout '')
In Properties bar write:
Text: My first Application
StartPosition: CenterSreen
FormBorderStyle: FixedSingle
Now it will take few seconds to load working panel. In Toolbox choose Button1 and drag it in Form1.
Double Click Button1 and write following code:
Code:
MsgBox("Hello, World")
Now after you finish this click Debug button (Little green button) and after debuging click on button, and a message will pop up.
What does this mean?
This call function what will show a Message.
This is a text what will show.
Easy? Yes its realy simple.
Console Application
1. Click File - Add - New Project
2. Choose Console Application
3. Write in name bar "HelloWorld" (Wihout '')
If you want to Console Application do something, in method Main() you must write programming code:
Code:
Module HelloWorld()
Console.WriteLine("Hello, world")
Console.ReadKey()
End Sub
End Module
After you finish this, click little green button, debug button and it will start a program, that should look something like this:
What does this mean?
This method will write new line in the Console with text ''Hello World''
Code:
Console.WriteLine("Hello, world")
Obtains the next character or function key pressed by the user. The pressed key is displayed in the console window
Making Mail Sending program - Windows Application
1. Click File - Add - New Project
2. Choose[/color] Windows Application
3. Write in name bar "SMTP Example" (Wihout '')
From Toolbox add Button1 and drag it on Form1. Now after you do that double click on Button1 and write following code:
On top of source code add:
Code:
Imports System.Net.Mail
Then in Button1 sub add:
Code:
Dim Mail As New MailMessage
Mail.From = New MailAddress("gmail@gmail.com")
Mail.To.Add("gmail@gmail.com")
Mail.Subject = "subject"
Mail.Body = "Write E-Mail message here"
Dim SMTP As New SmtpClient("smtp.gmail.com")
SMTP.Port = 587
SMTP.Credentials = New System.Net.NetworkCredential("gmail@gmail.com", "Password")
SMTP.EnableSsl = True
Try
SMTP.Send(Mail)
Catch ex As SmtpException
End Try
What does this mean?
This Imports is used to call function to sent mail
Code:
Imports System.Net.Mail
This part declare function for sending an mail, Mail is name of our declaration
Code:
Dim Mail As New MailMessage
Here you set up informations where to sent an mail
Code:
Mail.From = New MailAddress("gmail@gmail.com")
Mail.To.Add("gmail@gmail.com")
Mail.Subject = "subject"
Mail.Body = "Write E-Mail message here"
Like i said for "Dim Mail As New MailMeesage" this one is used too for declaration, but this time you settng up SMTPClient."smtp.gmail.com" is a gmail's smtp address
Code:
Dim SMTP As New SmtpClient("smtp.gmail.com")
Here you navigate our program to connect to Gmail SMTP client and sent mail
Code:
SMTP.Port = 587
SMTP.Credentials = New System.Net.NetworkCredential("gmail@gmail.com", "Password")
SMTP.EnableSsl = True
Try
SMTP.Send(MyMailMessage)
Catch ex As SmtpException
End Try
After you do that all corectly click green debug button on top of vb. It should start our program now. Now you click on Button1 and it will send mail to your gmail account if you writed corect your gmail informations.
Basicly that should be that, thats just beginning of VB .NET soon i will write part two of this tutorial and it will have much more examples, source codes and much more...
Credits:
Soul Collector
Have Fun!XD