Solved winforms listbox bound

Posted on 2005-04-20
Last Modified: 2008-02-01

How do I get selectedText + selectedvalue from a windows form bound  dataset listbox (Single selection listbox)

                 Listbox.ValueMember = "Customer_ID"
                  Listbox.DisplayMember = "Customer_Name"
                  Listbox.DataSource = ds.tables(0).defaultView

 when value selected I Need to get customerID and customer_Name


Question by:sainavya1215
    LVL 25

    Accepted Solution

    DirectCast(ListBox1.SelectedItem, DataRowView).Item("Customer_name")
    LVL 25

    Expert Comment

    although you can omit the tostring :-)


    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
    Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now