• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[TUTORIAL] Basic Syntax
String, Integers, Booleans and More

Next, we're going to work on all the syntax in VB.NET, building up to creating your first application.

Visual Basic's syntax is created to be more...logical I guess you could say. It could probably be read by anyone with common sense.

Now let's take a look at what we'll use the most...

Variables can be a variety of things. Mainly they're going to be strings, integers, booleans, and declaring objects. (Like WebClients (System.Net namespace) and other things)

Declaring Variables

The following image will show you how to declare variables:

Why there are more data types of variables you can declare for things that suite your need, these are the most common ones and will be the most used. Here is a list of all the different data types:

Data Types (Click to View)
Declaring Variable Arrays

Arrays use indices to stored multiple data types, and let you use a number to tell them apart because they will use the same name. It is basically like declaring, for instance, 5 strings in one. This is how you declare an array for a string:

Dim str As String() ' notice the () at the end. That is how you know if it is an array.

str = {"One string", "Two strings", "Etc."} ' These strings are enclosed in brackets and separated by commas.

'This is how you call "One string":
MsgBox(str(0)) ' would output in a message box: "One string"

'this is how you call "Two strings":
MsgBox(str(1)) ' would output in a message box: "Two strings"

'This is how you call "Etc.":
MsgBox(str(2)) ' would output in a message box: "Etc."

See how that works? Take a look at this GIF if you're having some trouble...

arrays can be very useful. If you have one thing that can have multiple values of if you are trying to split a string it will always be outputted in an array. These are valuable things to learn.

Declaring Objects

Objects can be a wide range of things. In this example we're going to be using a WebClient. A WebClient "provides common methods for sending data to and receiving data from a resource identified by a

While a WebClient has to be declared like this:
Dim wc As New WebClient()

Some things like the XMLReader and XMLWriter in the System.Xml namespace have to be declared like this:
Dim xml As XMLWriter = XMLWriter.Create(Arguments+)
Using xml As XMLWriter = XMLWriter.Create(Arguments+)
You can see all the arguments that something requires by going to MSDN.
Using Google Dorks will limit the results, example: some function site:msdn.microsoft.com

Anyways, continuing with the WebClient example.
Once you have declared your WebClient():

amespace YourNamespace

  <Public/Private Keyword> Class YourClass
    Dim wc As New WebClient() 'now it is declared
  End Class

End Namespace

Let's go over some of the various and most commonly used functions for a WebClient()

DownloadFile(Uri, String) -- Downloads a file from a Uri and saves it to the file path aka the second argument.
DownloadString(Uri) -- Downloads a string from a Uri and then returns that string.

Now to call these functions we would use the name of the Object we created that is the WebClient, in this case, wc and then add the function we want after that; i.e.:
wc.DownloadFile("http://www.somesite.com/file.exe", "C:\Users\Shit\Fuck\File.exe")

For the other one, since it returns a value, we would have to declare a string in order to "capture" that value. Like so:
Dim str As String = wc.DownloadString("http://www.somesite.com/file.txt")

Now the String that we declared will be the contents of the Text File that we downloaded.

SomeWhiteGuy - Original Post
[Image: uCZ3X.gif]

Possibly Related Threads...
Thread Author Replies Views Last Post
  Basic Mod CheeseToast 10 2,421 11-02-2013, 18:02
Last Post: Yamato
  TUTORIAL CHEAT ENGINE for mw3 [HARD] Tony. 5 1,476 10-24-2013, 15:22
Last Post: Tomsen1410
  Help improper syntax but i dont know where Brandeeno 6 1,567 07-28-2013, 19:25
Last Post: Brandeeno
Question Tutorial addon! [HARD] Tony. 2 1,062 04-30-2013, 13:55
Last Post: [HARD] Tony.
  [TUTORIAL] Various Statements KrypTiK 2 878 01-07-2013, 21:00
Last Post: kokole
  Help Game Programming Tutorial Ich1994 8 1,610 01-01-2013, 21:21
Last Post: Ich1994
  [TUTORIAL] C# Introduction KrypTiK 4 1,125 12-30-2012, 10:06
Last Post: KrypTiK
  [TUTORIAL] Handling Errors in VB.NET KrypTiK 0 660 12-29-2012, 20:28
Last Post: KrypTiK
  [TUTORIAL] Getting to know your way around the IDE KrypTiK 0 662 12-29-2012, 20:23
Last Post: KrypTiK
  [TUTORIAL] Introduction Into VB.NET KrypTiK 0 715 12-29-2012, 20:15
Last Post: KrypTiK

Forum Jump:

Users browsing this thread: 1 Guest(s)