Results 1 to 5 of 5

Thread: [2008] combobox issue

  1. #1

    Thread Starter
    Addicted Member dani2's Avatar
    Join Date
    Feb 2005
    Location
    Sibiu.ro
    Posts
    191

    Question [2008] combobox issue

    I need to populate a combobox directly without a datasource
    Code:
    items.add()
    and still be able to use a display value and a real value.
    How can be done?

    thank you
    Home is where your Head is

  2. #2
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Re: [2008] combobox issue



    Has someone helped you? Then you can Rate their helpful post.

  3. #3
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: [2008] combobox issue

    You could create a structure like this:

    VB.NET Code:
    1. Private Structure MyStructure
    2.         Private displayValue As String
    3.         Private realValue As Integer
    4.         Public Sub New(ByVal DisplayVal As String, ByVal RealVal As Integer)
    5.             displayValue = DisplayVal
    6.             realValue = RealVal
    7.         End Sub
    8.         Public Overrides Function ToString() As String
    9.             Return displayValue
    10.         End Function
    11.     End Structure

    Create a structure and add it to a combobox and you'll find that the structure has been added to the items collection but only the "DisplayValue" member is displayed, due to overriding the ToString function.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  4. #4
    Addicted Member
    Join Date
    Mar 2008
    Posts
    143

    Re: [2008] combobox issue

    Shut up and eat your banana!

  5. #5

    Thread Starter
    Addicted Member dani2's Avatar
    Join Date
    Feb 2005
    Location
    Sibiu.ro
    Posts
    191

    Thumbs up Re: [2008] combobox issue

    got it
    thanks all
    Home is where your Head is

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width