Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Pro VB.NET 2002/2003 For advanced Visual Basic coders working .NET version 2002/2003. Beginning-level questions will be redirected to other forums, including Beginning VB.NET.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old May 17th, 2006, 08:00 AM
Registered User
 
Join Date: May 2006
Location: Carriere, MS, USA.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Combo List Box

I have a combo listbox question, two parts:

When using a combo list box, normally the items are added to the drop down list by using items.add. Is there a way to have the list of items but not be hard coded into the code or require some type of database? In another language I messed with, there was a string table that would be a part of the application but provided a central location for list items.

Is there a way to associate items in a listbox or combo listbox with an alternative id... example... Alaska... AK... North Carolina... NC... in a list box... the full name of the states would be listed, but the abbreviations of the states would be what is used in something like a filename or textbox. I'm trying to stay away from if...then or case statements that would test for the state name and then equate the abbreviation.
  #2 (permalink)  
Old May 30th, 2006, 06:05 AM
Authorized User
 
Join Date: May 2006
Location: , , .
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

What is your data source for the combobox?

You could leave a dataset open in the background with the data
the dataset could containg two columns, abbreviation and text
AL, ALABAMA
AK, ALASKA
...
WY, Wyoming

ds row(0).item(0) is source for combox item(0)
ds row(1).item(0) is source for combox item(1)
...
ds row(50).item(0) is source for combox item (50)

If combobox item (36) is selected then
populate the textbox with data from
ds row(36).item(1)

I don't know if this what you are looking for.



Similar Threads
Thread Thread Starter Forum Replies Last Post
Msg Box with Combo List Coby Access VBA 4 July 28th, 2007 10:29 AM
IsValidData combo list box function JMichael Visual Basic 2005 Basics 4 June 20th, 2007 11:13 AM
Limiting a combo box to default list hamffjs Excel VBA 1 July 17th, 2006 03:19 PM
Drop Down/Combo box/List in a Form from DB mazimi Classic ASP Basics 2 October 1st, 2004 10:43 AM
Populate List Box by Combo Box Selection mmcdonal Access 2 June 15th, 2004 12:08 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.