Manually Populating a combo box


Author
Message
StarkMike
StarkMike
Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)
Group: Forum Members
Posts: 436, Visits: 944
How do I manually populate a combo box using a business object? I want to be able to choose which fill method to execute when the form opens and I'm not sure how to setup the combo box so that its filled manually. Which properties do i have to set?



THanks
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
The best way to dynamically populate a combo box using a business object is to use the type editor for the combo box and set the PopulationDataSourceSettings through the type editor.  Then open the .Designer.vb file for the form that contains the combo box.  In the form designer generated code (in the InitializeComponent() method), you will see the a new ListPopulationSettings object get created, have its properties set, and then it is set as the value for the PopulationDataSourceSettings.  Copy that code from the .Designer.vb file and paste it into your main code file where you want to dynamically populate the combo.  Repeat the process for the rest of the methods that you want to be able to call to fill the combo box. 

Once you have all of the pieces, set the combobox's PopulateOnFormLoad property to "Manual." Then, when you want to populate it, set the appropriate PopulationDataSourceSettings that you copied over and then call Requery() on the combobox. 

We do this quite regularly with list views.  We'll use one list view and have a method that dynamically creates the PopulationDataSourceSettings depending upon what is selected within the left-hand tree view.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search