You are viewing our Forum Archives. To view or take place in current topics click here.
Basic VB.net Tutorial Thread [Start Programming Today!]
Posted:

Basic VB.net Tutorial Thread [Start Programming Today!]Posted:

DictatorOfYourLife
  • Ladder Climber
Status: Offline
Joined: Feb 07, 201113Year Member
Posts: 314
Reputation Power: 14
Status: Offline
Joined: Feb 07, 201113Year Member
Posts: 314
Reputation Power: 14
First of all, you'll wanna download Visual Basic 2010 Express Edition for free or buy Visual Studio.
Download it here:
[ Register or Signin to view external links. ]
--------------------------------------------------------------------------------------------------------------------------------------

Imports

You can import .dll's when your program requires something by using the keyword 'Import'. Let's say you're making an Email sending program, you would have a line of code at the top of your source reading:
'Imports System.Net.Mail'
(For those of you who know c#, it's the same as the keywork 'using')
Picture example:
[ Register or Signin to view external links. ]



Declaring Variables and Constants

Declaring variables and constants is easy to do in Visual Basic, you will either use the keyword 'Dim' (variable) or 'Const' (constant) then the name of your variable/constant, and what it is (a string, integer, etc.). For example:
[ Register or Signin to view external links. ]
Beware when declaring variables/constants, if they're declared inside a block of code then they will be exclusive to that code (unless you use byref or byval, but that's further than this tutorial currently goes...), but if you make them outside a block of code then they're global variables/constants and can be used everywhere.



If, Else, and Elseif Statements & Message Boxes

Let's say you want a message box to display one thing if a number = 10, another thing if said number = 11, or a totally different thing if it doesn't equal either 10 or 11
You would use a code that looks like this:
[ Register or Signin to view external links. ]



Do, Loop

Let's say you want a block of code to keep doing something, then you would add a line with the keyword 'Do' before said block, and a line with the keyword 'Loop' after said block. Like so:
[ Register or Signin to view external links. ]



Try Statements

Try statements are very useful, if a code, for whatever reason, may provide errors then a try statement will make sure that these errors are avoided so that your program doesn't crash, then activates an alternative block of code. Basically, it works like this:
[ Register or Signin to view external links. ]



I'll be updating these tutorials when I have time, thanks for beginning to learn Visual Basic, hopefully you'll contribute something useful with it!
#2. Posted:
Database
  • Rising Star
Status: Offline
Joined: Sep 20, 200914Year Member
Posts: 721
Reputation Power: 32
Status: Offline
Joined: Sep 20, 200914Year Member
Posts: 721
Reputation Power: 32
very nice tut, should help people get started
#3. Posted:
ProgramminGawd
  • New Member
Status: Offline
Joined: Nov 27, 201112Year Member
Posts: 44
Reputation Power: 1
Status: Offline
Joined: Nov 27, 201112Year Member
Posts: 44
Reputation Power: 1
You do realise that the actual name for imports are namespaces, don't you?
#4. Posted:
DictatorOfYourLife
  • Ladder Climber
Status: Offline
Joined: Feb 07, 201113Year Member
Posts: 314
Reputation Power: 14
Status: Offline
Joined: Feb 07, 201113Year Member
Posts: 314
Reputation Power: 14
borna88 wrote very nice tut, should help people get started


Thanks for the positive feedback
#5. Posted:
-Birds
  • Ladder Climber
Status: Offline
Joined: Oct 01, 201112Year Member
Posts: 391
Reputation Power: 19
Status: Offline
Joined: Oct 01, 201112Year Member
Posts: 391
Reputation Power: 19
Really nice thread, You should make tuts on making a GUI or a program. That would be cool!
#6. Posted:
Kurisciple
  • TTG Master
Status: Offline
Joined: Apr 18, 201113Year Member
Posts: 810
Reputation Power: 41
Status: Offline
Joined: Apr 18, 201113Year Member
Posts: 810
Reputation Power: 41
Nice, I remember when you were just starting and you had that rpg game. You have come along way, good job
#7. Posted:
Z61
  • TTG Fanatic
Status: Offline
Joined: Apr 16, 201014Year Member
Posts: 4,309
Reputation Power: 179
Status: Offline
Joined: Apr 16, 201014Year Member
Posts: 4,309
Reputation Power: 179
-Birds wrote Really nice thread, You should make tuts on making a GUI or a program. That would be cool!

Not tutorials for specific things, then people can just copy and paste.
#8. Posted:
DictatorOfYourLife
  • Ladder Climber
Status: Offline
Joined: Feb 07, 201113Year Member
Posts: 314
Reputation Power: 14
Status: Offline
Joined: Feb 07, 201113Year Member
Posts: 314
Reputation Power: 14
DozenDevelopers wrote Nice, I remember when you were just starting and you had that rpg game. You have come along way, good job


Thanks haha, those were the days, I still quite like that game, despite it not having any real advanced code it in it did take a lot of repetitive crap to make it function with the shop and inventory and what-not. If nothing else, writing hundreds of lines of garbage built character
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.