[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Filling a list box

Posted on 2002-03-20
6
Medium Priority
?
245 Views
Last Modified: 2010-05-02
Maybe I'm missing something here or possibly I'm just going stark staring mad but....

I have a dialog box with a listbox control in it. I have associated this with a command in my dataenvironment by listing the datasource as my dataenvironment, the datamember as my command and the datafield as one of the fields from the command. (The actual command is a simple table scan).

When I run the dialog I get nothing in the listbox. However if I create a textbox on the dialog and bind it to the database in the exactly the same way the field from the first row of the table is displayed.

So the question is what have I missed out on the listbox or is there something else I want to do.

Steve
0
Comment
Question by:mouatts
[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
6 Comments
 
LVL 18

Expert Comment

by:mdougan
ID: 6883548
You will probably need to use a "datacombo" instead of the standard listbox.  The standard listbox might work if you set the style to drop-down combo, but I don't think any of the "list" modes would work, nor would a standard fully expanded listbox.

If you think about it, which element in the list is bound to the row?

With a datacombo, I think that you can specify one datasource/datamember for the list, and another for the text area of the combo.
0
 
LVL 11

Author Comment

by:mouatts
ID: 6883642
I understand what you are saying, but if the datafields weren't available for use why are they part of the listbox in the first place.

I think you are confusing listboxes with combos, there is no such style available on a listbox.

According to the VBHelp what I have done is valid.

Steve
0
 
LVL 18

Accepted Solution

by:
mdougan earned 200 total points
ID: 6884136
Well, what I was doing, talking about combos, is suggesting that if you used a combo, set either as a drop-down combo, or a simple combo, then my guess is that the text portion of the combo would be bound correctly to your datafield and display the data properly.

Your comment about "why are they part of the listbox..." was valid, so, the question was, how do we get it to work?  Well, I was on the right track at first.  A listbox can only be set to an item that already exists in the list.  If your list is empty, then when you try to put a bound column value into the selected listitem, it wont match anything in the list, and so, it wont work.

To get this to work, you must first fill your listbox with all of the distinct occurrences of that column in the database.  Then, you will see as you navigate to new rows, that the selection will highlight the element in the list that matches the element in the datafield.

So, my other suggestion was to switch to the datalist, which might allow you to specify a different source for the list, which would mean that you won't have to write code to fill the list yourself....
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 49

Expert Comment

by:DanRollins
ID: 7634196
Hi mouatts,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept mdougan's comment(s) as an answer.

mouatts, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.
==========
DanRollins -- EE database cleanup volunteer
0
 

Expert Comment

by:Jgould
ID: 7641817
request for deletion is made here

http://www.experts-exchange.com/Community_Support/Q_20438519.html

if no one objects will go ahead in 72 hours

Jgould-EE Moderator
0
 
LVL 1

Expert Comment

by:kodiakbear
ID: 7666065
Moving to the paq

kb
Experts Exchange Moderator
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

650 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