Microsoft ComboBox oddity

Posted by rbf on 15-Jan-2009 07:36

I am trying to do the simplest thing: binding a standard Microsoft ComboBox to a ProBindingsource which is bound to a dynamic PRESELECT query.

After binding is complete, the query NUM-RESULTS and the bindingsource:COUNT report 171 records. However, the ComboBox just displays the first 4 records.

What am I missing?

All Replies

Posted by Simon de Kraa on 15-Jan-2009 08:58

Did you correctly set ValueMember, DisplayMember etc.?

See attachment.

[View:~/cfs-file.ashx/__key/communityserver-discussions-components-files/19/ComboTest.p:550:0]

Posted by rbf on 15-Jan-2009 10:00

Yes I did - but in the Visual Designer. The code looks the same, but I will take a closer look tomorrow and see if I can get it working outside the Visual Designer.

BTW how could an incorrect setting explain that I can see 4 records?

Message was edited by:

Peter van Dam

Posted by Simon de Kraa on 15-Jan-2009 10:18

Well, I did get some inconsistent data with a particular combination of settings.

At least I thought I did. But now I cannot reproduce it so...

Posted by rbf on 16-Jan-2009 06:35

Thank you for the plain ABL example Simon. It helped me figure out the differences.

In my form I used VD to create the bindingSource and define a schema in the bindingSource so I could set the ComboBox properies at design time. Then I attached the query to the bindingSource in the constructor.

I cannot get that to work. Not in the VD and not in plain ABL code.

The only way I can get it to work properly is to dynamically bind the ComboBox after defining and opening the Query. You can define and bind the bindingSource at design time if you want, but not statically define the schema and bind it.

Personally I prefer the dynamic approach anyway (also I would like to put that code in another file as we discussed earlier) but I wonder if this is supposed to work 'statically'. The reason I tried the static approach was for a quick & dirty utility.

This thread is closed