473,320 Members | 1,817 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,320 software developers and data experts.

How to deal with Listbox and key-ids

Hi,
I am wondering what the best solution is to solve the following problem:

I have a table for instance employers and a second table employer_types. The
second table consists of two fields Type_Name and Type_ID.
in the employer table I store only the Type_ID

Now for the user interface I want to add a listbox, filled with the
employer_Types.Type_Name.

The Question now is what is the best way to get the Type_ID.
Ofcourse the simples way is to lookup the Type_name in the Table and get the
Type_id.
Another option in my opinion is to create a Hashtable if I want to store
than just the ID with the Name as a Keyfield. Drawback here is that the Names
need to be unique I guess. Alternatively I can creatte an Array and lookup
the value in there.

As I am not very experienced with this type of situations I am wondering if
there are any alternatives to do what I want, for instance a second value I
can populate in the listbox, or something completely different.

What are the "industry standards" here

Thanks for any advice

DJ
Nov 21 '05 #1
1 1063
I believe I found it in another post:
displaymember and displayvalue

"David J" wrote:
Hi,
I am wondering what the best solution is to solve the following problem:

I have a table for instance employers and a second table employer_types. The
second table consists of two fields Type_Name and Type_ID.
in the employer table I store only the Type_ID

Now for the user interface I want to add a listbox, filled with the
employer_Types.Type_Name.

The Question now is what is the best way to get the Type_ID.
Ofcourse the simples way is to lookup the Type_name in the Table and get the
Type_id.
Another option in my opinion is to create a Hashtable if I want to store
than just the ID with the Name as a Keyfield. Drawback here is that the Names
need to be unique I guess. Alternatively I can creatte an Array and lookup
the value in there.

As I am not very experienced with this type of situations I am wondering if
there are any alternatives to do what I want, for instance a second value I
can populate in the listbox, or something completely different.

What are the "industry standards" here

Thanks for any advice

DJ

Nov 21 '05 #2

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

Similar topics

2
by: Katie Beach | last post by:
I have a listbox in which I would like to be able to display a value of a hash, but when the user selects an element in the list, I need to be able to use the KEY associated with the value chosen for...
3
by: CJM | last post by:
I would like to be able to use an autocompleting listbox - that is, one where you can select an item in the list by typing the first few characters; the standard IE listbox only responds to the...
9
by: Megan | last post by:
Hi- I'm creating a database of music bands with their cds and songs. I'm trying to program an SQL statement so that I can enter a string of text in a textbox, press the 'Enter' key, and have...
3
by: vbMark | last post by:
Hello, In regards to the Registry... Can someone give me an example of how to list an unknown number of subkeys under a key, and put the key names in one column of a listbox, and the key...
2
by: Matt Sawyer | last post by:
Hi, I'm attempting to do a drag and drop operation from one listbox to another. I have my listboxes setup with SelectionMode = MultiExtended so that I can use the shift key, cntrl key, etc. to...
2
by: Merlin | last post by:
Been using VS NET for a while now but never really used the Standard ListBox control until now and whoops! where's the ItemData method gone - damn!, can't Microsoft leave things alone. Anyway...
1
by: john wright | last post by:
I have a dictionary oject I created and I want to bind a listbox to it. I am including the code for the dictionary object. Here is the error I am getting: "System.Exception: Complex...
2
by: DartmanX | last post by:
I have a form that does the following: - User inputs a serial number - VBA code does a lookup (SQL Query) and populates a listbox with results (4 columns in the Listbox) - Start Over (Listbox...
18
by: Zytan | last post by:
I want the same function to be run whether you press Enter or double click the listbox. It seems really verbose to write both handlers to both events everytime, even if they both call the same...
1
by: melvincwmah | last post by:
I have a form in which I would link the form fields to tables in the SQL database. Right now, I want to put in a listbox that will show three columns from a table called IssueAudit. The...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.