Jump to content




Recent Status Updates

  • Photo
      30 Sep
    rhossis

    laptop hard disk seated beneath motherboard but with no access panel. 7 hours to replace :(

    Show comments (3)
  • Photo
      19 Sep
    Chall

    I love it when you go to write a help thread, then while writing, you reach an enlightenment, and figure it out yourself.

    Show comments (3)
View All Updates

Developed by TechBiz Xccelerator
Photo
- - - - -

Tutorial - ListBox, ComboBox & Command button.

combobox

  • Please log in to reply
15 replies to this topic

#1 travy92

travy92

    CC Resident

  • Just Joined
  • PipPipPipPip
  • 73 posts

Posted 08 September 2007 - 10:04 PM

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)
Posted Image
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

Private Sub cmdPrint_Click()
lstList.AddItem cboText.Text
cboText.AddItem cboText.Text
End Sub

This is all that's needed to make this very simply program.
----------------------------------------------------------------
CODE EXPLANATION

Private Sub cmdPrint_Click()

Basically this means everytime you click cmdPrint, it will do the action as specified (Below)
----------------------------------------------------------------

lstList.AddItem cboText.Text

This code means add whatever text is written in the cboText.Text box to lstList box.
----------------------------------------------------------------

cboText.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)
----------------------------------------------------------------

End Sub

This needs to be added at the end of every code.
---------------------------------------------------------------------------------
And you're done!
Posted Image
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):
Posted Image
---------------------------------------------------------------------------------
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..

Attached Files


  • 1

#2 TcM

TcM

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 7,563 posts

Posted 09 September 2007 - 02:25 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.codecal...-screen-v2.html
  • 0

#3 travy92

travy92

    CC Resident

  • Just Joined
  • PipPipPipPip
  • 73 posts

Posted 09 September 2007 - 02:38 AM

Oh man, i can't thank you enough! Wonderful !
  • 0

#4 TcM

TcM

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 7,563 posts

Posted 09 September 2007 - 03:20 AM

No problem, hope you use it in your next tutorial. I fixed it btw, download it again.
  • 0

#5 Lukica

Lukica

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 08 January 2008 - 07:55 AM

Thank you ... I was looking for this
  • 0

#6 sammy..the..great

sammy..the..great

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 18 January 2008 - 04:33 AM

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 :-)
  • 0

#7 Bigig

Bigig

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 01 February 2008 - 10:24 PM

Thanks for this, this will be very helpful.

-BigIg
  • 0

#8 jodlajodla

jodlajodla

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 11 March 2008 - 08:54 AM

dan
  • 0

#9 Abaset

Abaset

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 04 August 2009 - 02:42 AM

Good man

Hellio to all

Edited by WingedPanther, 04 August 2009 - 06:04 AM.
Double post

  • 0

#10 unleashed-my-freedom

unleashed-my-freedom

    CC Lurker

  • Just Joined
  • Pip
  • 8 posts

Posted 14 November 2009 - 07:06 PM

what is the different between combo box, text box, label?
Thank You
  • 0

#11 TcM

TcM

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 7,563 posts

Posted 23 November 2009 - 02:55 AM

Combo is a drop down list of items, textbox is an empty space to insert your text and a label is a place to display text (usually the programmer uses it.. the user will not be able to edit the text in it)
  • 0

#12 hawaii94

hawaii94

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 09 December 2009 - 05:32 PM

i like the outline of your tutorial. i like the screen shots and the comments that go along with it. nice and easy to follow.
  • 0





Powered by binpress