Welcome to my first tutorial on Visual Basic (or any language for that matter)
This tutorial is extremely easy and can be used in programs.
Rating, 1/5 (extremely easy).
Now to get started!
Step one: Open Visual Basic, go to File -> New Project (Ctrl + N) and click on Standard EXE when the box pops up
Step two: Click on the List box and make the box as big as you want, do the same with a text box
Now it should look a bit like the picture below
Step three: Now comes the actual coding part, double click on the form and you should see
In the space above End Sub type in the followingCode:Private Sub Form_Load() End Sub, this makes it so instead of having to type in List1.AddItem all the time we just have to type in ".AddItem". After you typed With List1 in add the following codeCode:With List1please note: you can change the letters to different things like words, numbers, characters and such.Code:.AddItem "A" .AddItem "B" .AddItem "C" .AddItem "D" .AddItem "E" .AddItem "F" .AddItem "G" .AddItem "H" .AddItem "I" .AddItem "J" .AddItem "K" .AddItem "L" .AddItem "M" .AddItem "N" .AddItem "O" .AddItem "P" .AddItem "Q" .AddItem "R" .AddItem "S" .AddItem "T" .AddItem "U" .AddItem "V" .AddItem "W" .AddItem "X" .AddItem "Y" .AddItem "Z"
So now our code should beStep Four: Double click on the list box and add this code to itCode:Private Sub Form_Load() With List1 .AddItem "A" .AddItem "B" .AddItem "C" .AddItem "D" .AddItem "E" .AddItem "F" .AddItem "G" .AddItem "H" .AddItem "I" .AddItem "J" .AddItem "K" .AddItem "L" .AddItem "M" .AddItem "N" .AddItem "O" .AddItem "P" .AddItem "Q" .AddItem "R" .AddItem "S" .AddItem "T" .AddItem "U" .AddItem "V" .AddItem "W" .AddItem "X" .AddItem "Y" .AddItem "Z" End With End Subthis basically tells the text box when we click on a value in the list box we want it to appear in the text box.Code:Text1.Text = List1.Text
Your finished code should look a bit like this (i added some comments so you get the drift what is happening)
That is the end of my tutorial have fun with it.Code:Private Sub Form_Load() With List1 ' we add the letters to our list when the form opens .AddItem "A" 'you can change the letters to words, characters, numbers etc. .AddItem "B" .AddItem "C" .AddItem "D" .AddItem "E" .AddItem "F" .AddItem "G" .AddItem "H" .AddItem "I" .AddItem "J" .AddItem "K" .AddItem "L" .AddItem "M" .AddItem "N" .AddItem "O" .AddItem "P" .AddItem "Q" .AddItem "R" .AddItem "S" .AddItem "T" .AddItem "U" .AddItem "V" .AddItem "W" .AddItem "X" .AddItem "Y" .AddItem "Z" End With End Sub Private Sub List1_Click() Text1.Text = List1.Text 'When you click a letter from the list box it shows up in the text box End Sub
C+C is welcome thanks.
edit: fixed the pictures





)


Reply With Quote