[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Filling a list box

Posted on 2002-03-20
6
Medium Priority
?
248 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
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

868 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