Assigning values to listbox in a Win App vs. Web App

  • Thread starter Thread starter CN
  • Start date Start date
C

CN

I'm used to assigning values to a listbox in a web app,
but am not sure how to do it in a Win app.

Goal: I have a db with two columns - Product Name and
Product ID. I want to dynamically populate items in a
listbox that display the Product Name, but submit the
Product ID when an item is selected.

How do you do this in a Windows Application??
 
Use the ValueMember and DisplayMember properties of the ListControl. They
should be set to properties of your datasource.

If you are storing objects in your list control, you can specify any public
property. If you are storing a dataset in your listbox, you can specify any
column name.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top