Combo Box with Custom method


Author
Message
Ger Cannoll
Ger Cannoll
Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)
Group: StrataFrame Users
Posts: 430, Visits: 507
I have a Combo Box on a form, based on a Business Object. In PopulationdataSourceSettings, I have the MethodToExecute as MyFillByCode. This is a Method I have set up in the Business Object which takes one parameter. In the PopuationDataSourceSettings, it comes up as MyFillByCode(String). What I want is something like MyFillByCode("MyValue") but can change the String.

Because the parameter is not set, the form gives an error on instantiation. Where/how do I pass the method the parameter.

The parameter will not change once the form is loaded. I am using the Combo Box to lookup a table with Codes and Descriptions and store all Codes and descriptions in one table (e.g. Countries, Areas, reps, Groups) . One of the fields in the table identify the type of Lookup, and this is the parameter I am trying to pass. I could have a no. of simular Combo Boxes on the same form , each one for a different lookup.

Reply
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Gerard,



You're getting there. There are two ways to provide parameters to the fill method setup in the population settings:



1. (suggested) Handle the ListPopulating event (as Edhy showed and you've got working). If this is used, then every time the Requery method is called with no parameters (see below), this event will be fired and the parameters provided to the fill method.



2. Provide the paremeters to the combo's Requery method:



Me.MyCombo.Requery("MyValue") '-- where "MyValue" is the parameter needed by your fill method




You can pass whatever your fill method needs to Requery method directly. However as mentioned, handling the ListPopulating event is preferred as this isolates setting parameter(s) to a single place.



That's how it gets filled using a fill method.



The PopulateOnFormLoad property determine if the combo is loaded during the FormLoad event, as controlled by the InitializePriority property (lower numbers get loaded first). If set to manual, you must call the Requery method to fill it. However, at any time, you can call requery to refill it. This is very common.



I hope that is starting to make sense!
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