Welcome to HBH! If you had an account on hellboundhacker.org you will need to reset your password using the Lost Password system before you will be able to login.

VB

By ghostghost | 4485 Reads |
0     0

Programming visual basic. See the bottem for licencing info.

Visual basic is an GUI basic programming language. There is no command line Visual basic….that I know of… Unlike C or pascal even, all of the GUI has been done for you.

I. varibale delcrations. To declaire a variable in VB you simply do this: dim varible as type For example: Dim hello world as string. A string is in quotes: "This is a string"

Ok now for a basic program.

Private Sub Form_Load() msgbox "Hello world!" ,, "Hi!" End Sub

This program, creates a message box when the form loads.

This messege box is defalut as an ok box. We can change type of msg box by added a msg box constant in it. msgbox "Hello world!" ,vbyesno, "Hi!"

This one makes a yes or no box.

Another program!

If vbYes = MsgBox("Do you want to quit?", vbYesNo, "Quit?") Then Unload Me Else MsgBox "Ok then…", , "…:D" end if End Sub

This program asks if you want to quite. If you say yes, then it quits.

Or else it brings the msg box up. The end if statment tells it to end the block there. As you can see VB is a very easy to grasp language, don't worry you'll get it in no time.

II. Logical opererations In C logical operations are symbolic; != is if not equal too and == is equal too, and = means equals. In visual basic, logical operations are…deferent…

First off, = means equals, or equal too.

a = "blah" if a = blah then

In C this would be

a = "blah" if (a == blah) { }

If and or else are also in your arsonal.

Its pretty easy to grasp. if a = "a" and b = "b" or a "b" and b = "a" then statment else statment. end if III. Loops

do until statment;

Dim blah As Integer blah = 1 Do Until blah = 5 MsgBox "asd", , "asd" blah = blah = +1 Loop End Sub

This program tells the computer that blah is an integer and to excute a statment until blah = 5 The loop statment tells it to end the loop block there.

do while

Private Sub Form_Load() Dim blah As Integer blah = 1 Do While blah = 1 MsgBox "asd", , "asd" Loop

End Sub

This program tells the computer to do the block of code while blah is 1

The for loop. The for loop is difficult to explain.

Private Sub Form_Load() Dim blah As Integer blah = 1 For blah = 1 To 5 MsgBox "asd", , "asd" Next

End Sub

Well…. not really…..

This program tells the computer to do that block of code, until it gets to five. ….that wasnt so hard…

That covers abot everything for this artical.

Here are some tips:

screen.activeform is vb constant for the form that is active.

for example:

If Screen.ActiveForm.Caption = Form1.Caption Then statment

Vbnewline

This is like telling it to do this: text1.text = "text" & vbnewline & "text"

would be like:

text text

me.hide Hides the form.

Well that ends this artical.

Licence: You may do what you want with this artical just please keep credits where they are due.

Copyright The_Inferno 3/3/2005 Nullbranded.tk P.s you will always rember this as the day you almost caught jack sparrow…

Comments
ghost's avatar
ghost 17 years ago

In C this would be

a = "blah" if (a == blah) { }

That aint C, but othewise good article :)

ghost's avatar
ghost 17 years ago

In C this would be a = "blah" if (a == blah) { }

Thats PHP you fuck up.