Visual Basic - VB code, scripts and tutorials.

OK, now for the Visual Basic ( VB )Tutorials, VB codes / scripts and VB programs. Visual Basic is what I started off with when I first started programming. Visual Basic is extrememly easy to use and learn, but is also Windows reliant, so you cannot run the VB applications on other Operating Systems without a Visual Basic emulator, and Visual Basic does teach you some bad habits. The worst habit you can pick up is relying on the Visual Basic auto capitalisation feature, or in other words, Visual Basic puts the capitals in where they are needed and auto corrects some of the code. In C++ you will often find yourself looking for a problem, when all you needed was a capital somewhere. Now here is some Visual Basic code to get you started off with the basics, and below are some Visual Basic programs I have made (Source not included).'

You can view all the Visual Basic editable commands (not API) for an object when in the code editing window. Say you are in a Visual Basic forms code, you type either Form1. or Me. and Visual Basic will come up with a list of things you can choose, for example, Me.Caption, Me.Width, Me.Height, etc, all of these are changeable values, but there will be some such as Me.Name, which will only return a value.

Respectively you can control all of a Visual Basic windows (forms) properties, including it's shape using the Windows API, there are some great API programs out there that list all known API, all you need to do is a google search.

 

Here is the Visual Basic Tutorials Page, the following are just little scripts.

 

Some Visual Basic Scripts:

1. MsgBox "Hello World", vbInformation, "Hello World" 'This will Display a message box with Caption: Hello World and Title: Hello World

2. InputBox "Hello World", "Hello World", "Hello World" This Displays an Inputbox with Caption: Hello World, Title: Hello World and Default text of: Hello World

3. For this one you will need a textbox(txtCaption) and a command button(cmdCaption).

Private Sub cmdCaption_Click()

Me.Caption = txtCaption.Text 'This will change the caption of the active form the the text in txtCaption. Me.Caption could be anything

End Sub 'to do with a string. EG: Another textbox.

4. Loops - Loops work like timers. This will change the caption of the open form to add the number of the current loop cycle. It is limited to 10 loop cycles so the caption should appear as 12345678910.

Private Sub Form_Load()

For i = 1 To 10

Me.Caption = Me.Caption & i

Next i

End Sub

 

Here Are A Few Visual Basic Programs I Have Made In Visual Basic 6. Please note that these Visual Basic Programs are not the best as they are getting pretty old.

A little Media Player in Visual Basic

An Instant Messenger Spammer in Visual Basic

A little Chat program in Visual Basic

A Net Send applicaton in Visual Basic

A Computer helper in Visual Basic

A Clipboard Logger in Visual Basic

Some API Examples in Visual Basic

A Folder and File Editor in Visual Basic

 

     

 

Copyright 2008, Donald Urquhart
Proudly supported by http://www.cdadc.com