INTRODUCTION
Seeing as i've learned quiet a bit about visual basic, I'd like to introduce you to my second tutorial.
(My first was "Tutorial - SmarterChild Copy")
-------------------------------------------------------------------
WHAT WE'RE DOING
Basically in this mini tutorial we'll learn about adding text to a ListBox using a command button and a combo box/saving search history in combo box.
-------------------------------------------------------------------
GUI (Layout of the form)
This is my GUI (Layout)
You can use any GUI but this is mine.
It consists of:
1 Command Button:
Name: "cmdPrint"
Caption: "Add text to ListBox"
1 ListBox:
Name: "lstList"
Caption: (None)
1 ComboBox:
Name: "cboText"
Caption: (None)
Note: Don't add the quotes in caption/name(").
----------------------------------------------------------------
NAME EXPLANATIONS:
cmdPrint: "cmd" stands for Command, since it's a command button, use cmd. "Print" means Print... Nothing special.. It can be anything you want.
lstList: "lst" stands for List, since it's a ListBox, use lst. List simply means a list.
cboText: "cbo" stands for ComboBox, since it's a ComboBox, use cbo. "Text" means text.
----------------------------------------------------------------
CODE
This is all that's needed to make this very simply program.Private Sub cmdPrint_Click()
lstList.AddItem cboText.Text
cboText.AddItem cboText.Text
End Sub
----------------------------------------------------------------
CODE EXPLANATION
Basically this means everytime you click cmdPrint, it will do the action as specified (Below)Private Sub cmdPrint_Click()
----------------------------------------------------------------
This code means add whatever text is written in the cboText.Text box to lstList box.lstList.AddItem cboText.Text
----------------------------------------------------------------
This code means add the text that's written in cboText box into the cboText box... (So like saving history... This function can be used for an internet browser... I may be writing a tutorial on making an internet browser, if you want)cboText.AddItem cboText.Text
----------------------------------------------------------------
This needs to be added at the end of every code.End Sub
---------------------------------------------------------------------------------
And you're done!
This is the example of the product with text in the ListBox.
And another one with the text saved in the ComboBox (Or History if you will):
---------------------------------------------------------------------------------
So this is goodbye for now.
This tutorial was made by me, Travy92.
Special thanks to Tcm9669 for the Screenshot program.
EDIT - I'll include some samples for the lazy people..
Last edited by Jordan; 09-10-2007 at 06:16 AM.
These are nice tutorials that you are making, and I noticed that you used a program from here to make screenshot so I modified it for you so whn you press Start or CTRL+S it will hide the window and when you press CTRL+E It will stop taking screens and the window will show again. Hope you like it, download it from here:
http://forum.codecall.net/vb-tutoria...screen-v2.html
Oh man, i can't thank you enough! Wonderful !
No problem, hope you use it in your next tutorial. I fixed it btw, download it again.
Thank you ... I was looking for this
Thanks for this! I think I'm going to find this very useful, and now, my post count is one I should be able to download it! lol :-)
Thanks for this, this will be very helpful.
-BigIg
dan
....
There are currently 2 users browsing this thread. (0 members and 2 guests)
Bookmarks