How do I show a symbol relevant to the current ListBox selection?



Read and add posts to the Visual Basic 6.0 Forums

Download some of my programs and OCXs

Read the Tips here

The old style forum is still available here




From: Simon Hudson
Date: Wednesday 10 October 2001 12:44 PM
Subject: VB6
Question: I'm having problems with VB6. I need to insert a list box to show countries.
This is for a currency converter I need for a college assignment.
I can input the list box, but can't figure out how to select a country in the list box.

say the list box contained A,B,C,D countries.
I want a currency symbol to be displayed in a label box when say selecting B.
I use the visible function and set it to true, but this displays the symbol if I select A,B,C or D.

If you can help me with the correct code I need, I'd be most helpful.

Simon Hudson

Create a Listbox called List1 and a Label called Label1.

Add 'Euro', 'Japan', 'UK' and 'USA' to the list.

Add this code:

Private Sub List1_Click()
Select Case List1.Text
Case "Euro"
    Label1.Caption = ""
Case "Japan"
    Label1.Caption = ""
Case "UK"
    Label1.Caption = ""
Case "USA"
    Label1.Caption = "$"
End Select
End Sub

Is this what you want?  If not, contact me and let me know what you want to do.

Archived Comments

From: Heather
Date: Tuesday, November 6, 2007 at 16:54:40
Comments: This section helped me SOO much! Thank you for asking and posting, both of you. Wohoo!
From: Thomas Aeruthayan
Date: Thursday, August 7, 2003 at 14:04:04
Comments: I am using a data combo to drop down a list of items. eg. 
Item 1 costs $20.00
Item 2 costs $35.00
How do I get to input the cost of a particular item into a label that corresponds to the item selected in the data combo?


Label1.Caption = Combo1.Text
From: <No name>
Date: Monday, December 9, 2002 at 00:39:22
Comments: could be very helpful, thanks

Martin Allen 1999 - 2011.  Last updated Monday 08 August 2011 08:01:17 PM +0100.