Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do I make a Multicolumn Combo
Message
From
26/07/2000 20:56:27
 
 
To
26/07/2000 15:39:56
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00397268
Message ID:
00397390
Views:
13
>I need to make a combobox with 2 columns, both populated by fields from the same view. There will be a method that uses the value from the 1st column to search for records.
>
>1. How do I make the fields show up in the combo?

On initial opening of the view, make certain to use the NoDataOnLoad option. Change the ComboBox properties; make ColumnCount = 2, ColumnWidths to a comma delimited string giving the width of each Column eg '69,42', RowSourceType = 6 (Fields), RowSource a comma-delimited string in the form 'ViewAlias.Field1,Field2', and BoundColumn = 1. When the ComboBox gets focus, set the View parameter, and issue a Requery(). Initialize the DisplayValue to the starting value if necessary; it must at least be the right data type. Makes its own sauce. If the View changes it's values as your form runs, you have to issue a ComboBox.Requery() to requery the ComboBox's RowSource, which may require updating the view's parameter value first.

>2. How do I address the value in the 1st field in my search code?

name of ComboBox object.Value, which is why you set the BoundColumn, although the default is column 1. The view will have shifted to the record whose value is shown in the ComboBox. The view can have more fields than the number displayed in the ComboBox. If other controls use the same view as their COntrolSource, their COntrolSource will update when a value is selected. If the ComboBox is a control in the grid, don't make the same view driving the grid also referenced as the RowSource - if you need that, open a second instance with a separate name to serve as the ComboBox RowSource.

>
>Thanks
>JD
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform