Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Listbox

Posted on 2006-06-12
3
Medium Priority
?
288 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

704 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