473,394 Members | 1,759 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Displaying a title, but using 2nd value from a drop-down menu

Hi All

Sorry for the confusing subject, but I'm hoping that you will be able to
help.

In very basic terms I want to emulate a <SELECT> HTML box in VB.

All I want to do is display a title name in the drop-down list, but the
actual value I use would be something else.

For example, in HTML I would simply enter:

<OPTION VALUE="fred">Mr Fred Smith</OPTION>
<OPTION VALUE="bill">Mr Bill Smith</OPTION>
<OPTION VALUE="bob">Mr Bob Smith</OPTION>

And when the user selected one of the above display names I could then
simply take the value (eg, bill) and work with that.

In VB you only seem to be able to have 1 value for displaying and using.

Is there a way round this?

Rgds

Laphan


Jul 17 '05 #1
1 1851
> Sorry for the confusing subject, but I'm hoping that you will be able to
help.

In very basic terms I want to emulate a <SELECT> HTML box in VB.

All I want to do is display a title name in the drop-down list, but the
actual value I use would be something else.

For example, in HTML I would simply enter:

<OPTION VALUE="fred">Mr Fred Smith</OPTION>
<OPTION VALUE="bill">Mr Bill Smith</OPTION>
<OPTION VALUE="bob">Mr Bob Smith</OPTION>

And when the user selected one of the above display names I could then
simply take the value (eg, bill) and work with that.

In VB you only seem to be able to have 1 value for displaying and using.

Is there a way round this?


See if this gives you any ideas... start a new project and place a ComboBox
and a CommandButton on the form. Paste this code into the form's code window
and run. Drop down the list and click on a name. Watch what prints in your
Immediate Window when you click on the CommandButton.

Rick - MVP

Dim NickName As String
Dim Names(2) As String

Private Sub Form_Load()
Dim X As Long
Names(0) = "Mr. Frederick Smith\fred"
Names(1) = "Mr. William Smith\bill"
Names(2) = "Mr. Robert Smith\bob"
For X = 0 To 2
Combo1.AddItem Split(Names(X), "\")(0)
Next
Combo1.Text = "Select a name"
End Sub

Private Sub Combo1_Click()
NickName = Split(Names(Combo1.ListIndex), "\")(1)
End Sub

Private Sub Command1_Click()
Debug.Print NickName
End Sub
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Burt Lewis | last post by:
Hi, I'm using an ASP script and an xsl file to display the feed from Boston.com on a web page. http://www.boston.com/tools/rss/ It works nicely but I am having trouble limiting the number...
3
by: Gretjns | last post by:
I'm trying to figure out this script doesn't display any text in the child window and why I'm getting the null or not an object error. It's taken directly from the Javascript and DHTML cookbook...
0
by: Fronky | last post by:
Hope someone can help. I am still learning, so no laughing please. I am displaying records from a database using Response.Write(""); instead of the usual datagrid method. I am doing it this way...
12
by: korund | last post by:
How to make javascript alert with non-english text displaying correctly on computers where english only is default system & language settings? For web page the solution is just use meta tags:...
1
by: mandakini | last post by:
Hello freinds I am working on this url http://72.36.156.243/compbuild.php Here I am using ifram and displaying dynamic value I don't know how to use iframe as array how to assign array and...
3
sammyboy78
by: sammyboy78 | last post by:
I'm trying to display an array of objects using a GUI. My instructions are that the CD class and it's sublcass don't need to change I just need to modify class CDInventory to include the GUI. I'm not...
14
by: ashraf02 | last post by:
i used a code from a website that allows you to display images. however everything works fine from storing the image to the database but it does not display the image. the following code is the...
7
by: hsegoy1979 | last post by:
Dear All Iam using file upload control and i want to display image in another pop up page .But image is not displaying in image control iam sending image path thru querystring . here is my code ...
7
by: RichB | last post by:
I am trying to get to grips with the asp.net ajaxcontrol toolkit, and am trying to add a tabbed control to the page. I have no problems within the aspx file, and can dynamically manipulate a...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.