Ricardo,
Since you are trying to popualte a combo from a business object, you should use the PopulateionDataSourceSettinngs on the combo box itself. Also you will need to change the population method from manual to BusinessObject on the combo box also. The code sample you showed above is actually not going to work for two reasons. First, you are populating the business object twice. Once in the ParentFormLoading of the combo box and again in the load of the business object itself.
Secondly, the reason you are still getting the error is because the DataSource, DisplayMember, and ValueMember of the combo box were never set which tells the combo how to populate and interact with the bound data. So you need to do one of two things:
Manual Population
1. Remove the Me.ClubesBO1.FillTop100() from the ParentFormLoading event of the business object itself. Leave the other in the combo boxes ParentFormLoading.
2. Make the combo box ParentFormLoading event look like this:
Private Sub ComboBox1_ParentFormLoading() Handles ComboBox1.ParentFormLoading
Me.ClubesBO1.FillTop100()
'-- Set the display member
Me.ComboBox1.DisplayMember = "[MyDisplayFieldName]"
Me.ComboBox1.ValueMember = "[MyValueMemberField - Usually a Primary Key Field]"
Me.ComboBox1.DataSource = Me.ClubesBO1.CurrentDataTable
End Sub
End Class
Replace the display and value member fields with the names of the fields you wish to use.
Better Solution - PopulationDataSourceSettings
1. Remove all of calls to ClubesBO1.FillTop100 from all methods.
2. Through the form designer, navigate to the combo box.
3. In the property sheet, navigate to the PopulationDataSourceSettings
4. Click the "..." button to the right of the value
5. When the editor appears, set the Business Object Type to "ClubesBO"
6. Set the Method to Execute to "FillTop100()"
7. Add the fields that you wish to have displayed in the combo box at the bottom left of the editor
8. To tell the combo box how to use those selected display fields, set the Display Member Format String. For example, if you only added a single display member field, the format string will look like this: {0}
9. Pick the value Member field. This is the fields that will be bound to the data.
10. Click OK.
11. Set the PopulationType property on the combo box to Business Object.
12. Save your changes and run the form. This should get you going.
Let me know if you have any questions.