|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
listbox displaymember & valuememberI want to populate a listbox with States but use abbreviations when someone
selects a state. For instance if I have California Arizona Nevada in the listbox, when the user clicks on "California", I would like to return the value "CA". I did look at the properties Displaymember and Valuemember but they look like they need to come from a datasource. How can I accomplish this task? Thanks Yes, your datasource must have at least two values, one to be displayed
and one to be the value. T Henry Jones wrote: Show quoteHide quote >I want to populate a listbox with States but use abbreviations when someone >selects a state. > >For instance if I have > >California >Arizona >Nevada > >in the listbox, > >when the user clicks on "California", I would like to return the value "CA". >I did look at the properties Displaymember and Valuemember but they look >like they need to come from a datasource. > >How can I accomplish this task? > >Thanks > > > > Yes, I know that there must be two values, but I was asking how to do what
I need to do in code to accomplish this with the few values that I have. Do I need to put the values into a table or can I do something like listbox1.items.add "California" listbox1.items.add "Nevada" etc.... and if I can do this in code, how can I return "CA" when "California" is clicked? Show quoteHide quote "tomb" <t***@technetcenter.com> wrote in message news:OLDsg.87938$qd2.55506@bignews6.bellsouth.net... > Yes, your datasource must have at least two values, one to be displayed > and one to be the value. > > T > > Henry Jones wrote: > >>I want to populate a listbox with States but use abbreviations when >>someone selects a state. >> >>For instance if I have >> >>California >>Arizona >>Nevada >> >>in the listbox, >> >>when the user clicks on "California", I would like to return the value >>"CA". I did look at the properties Displaymember and Valuemember but they >>look like they need to come from a datasource. >> >>How can I accomplish this task? >> >>Thanks >> >>
Show quote
Hide quote
"Henry Jones" <henryjo***@yada.com> schrieb: Check out the code snippets in >I want to populate a listbox with States but use abbreviations when someone >selects a state. > > For instance if I have > > California > Arizona > Nevada > > in the listbox, > > when the user clicks on "California", I would like to return the value > "CA". I did look at the properties Displaymember and Valuemember but they > look like they need to come from a datasource. <URL:http://dotnet.mvps.org/dotnet/code/controls/#ItemData>. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> |
|||||||||||||||||||||||