[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Filling a list box

Posted on 2002-03-20
6
Medium Priority
?
250 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
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
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

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month9 days, 11 hours left to enroll

591 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