Solved

Listbox

Posted on 2006-06-12
3
279 Views
Last Modified: 2010-04-23
I have form1 which has a button which allows a user to lookup a customer name.  The button, when clicked opens another form (form2) which contains a listbox and the customer names are listed in the listbox bounded from a datasource (sql table).  I would like the user to be able to select an item in the listbox (by highlighting it) and clicking the select button at the bottom of the form2 and then have the item display in a text box on form1.  I am trying the following code to accomplish this:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSelect.Click

        form1.tbItemNmbr.Text = Me.lbItems.SelectedItem.ToString
       
    End Sub

The code displays "System.Data.DataRowView" in the text box not the customer name as desired.  Can someone point me in the right direction on this?
0
Comment
Question by:mwalsh2000
  • 2
3 Comments
 
LVL 10

Expert Comment

by:vadim63
ID: 16889100
You have to set    Me.ListBox1.ValueMember = "Customer Name" and then use:

form1.tbItemNmbr.Text = Me.lbItems.SelectedValue
0
 
LVL 10

Accepted Solution

by:
vadim63 earned 500 total points
ID: 16889106
I mean:  Me.lbItems.ValueMember = "Customer Name"
0
 

Author Comment

by:mwalsh2000
ID: 16889164
That got it, thanks!
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

746 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

12 Experts available now in Live!

Get 1:1 Help Now