[Gambas-devel] addressing collection members question
Benoît Minisini
gambas at ...1...
Wed Dec 2 00:24:03 CET 2009
> I must have a mental block on this cause can't figure it out.
>
> I want to pass a field name to a routine to select some data to display in
> a listbox:
>
>
> Lets call the collection the_data and the field name "occupation"
>
> If I use this code:
>
> listview1.add (the_data!pk, the_data!occupation) then
>
> the names appear in the list.
>
> But I want to be able to address the field by passing the name as a string
> to the subroutine
>
> eg Sub Do_somthing (field_name as string)
>
> but I can't figure out how to address the collection using the field name
> so that WhatGoesHere is correct.
>
> listview1.add (the_data!pk, WhatGoesHere?)
>
> Hope thats not too ambiguous
>
> Any help appreciated.
>
> Richard
>
the_data[field_name]
--
Benoît Minisini
More information about the Devel
mailing list