[Gambas-user] Creating a Variant[] on the fly

Bruce Bruen bbruen at ...2308...
Mon Apr 18 07:41:22 CEST 2011


I have a custom gridview control which has a method "Add", which adds a 
Variant[] array into an internal collection. IOW it exposes the method :

PUBLIC SUB Add(dataitem as Variant[], key as String)

This allows me to add "any" type of data into the grideview row as the custom 
control knows how to convert the received data into strings.

But when I try the following:
	csvRelData.Add([.LocalCardinality, .TargetCardinality], "Cardinalities")
where .LocalCardinality and .TargetCardinality are both integers, I get a
"Type mismatch: wanted Variant[], got Integer[] instead" error.

I know I could declare and load a Variant[] variable locally, item by item, 
but this expands the code so much.

(The control is going to display something like the PropertyList in the IDE 
but there are three columns, the parameter name, eg "Cardinalities" and two 
values, one for the local instance and one for the target instance.)

Is there (again) something simple that I just can't see today to make this 
construct work?

-- 
best regards
Bruce Bruen




More information about the User mailing list