Show contact details ?

taximania

Well-Known Member
Licensed User
Longtime User
I have a list of contacts.
I can show details in code by
label1.text=con.FirstName or
label1.text=con.LastName

If I have a combobox with several options in it, eg

FirstName
NickName
LastName

How would I be able to do
label1.text=con.(combobox.item(x))

Hope this make sense :sign0148:
It's doin mi ed in :confused:
 

specci48

Well-Known Member
Licensed User
Longtime User
Hi taximania,

I'm sure to understand your wish but I don't think that it is possisble in basic4ppc. :sign0013:
The control statement allows only the dynamic naming of controls but not of control methods or functions. You are looking for something like the interpret statement in rexx.

If someone is able to correct my answer, I would really appreciate this...


specci48
 

agraham

Expert
Licensed User
Longtime User
One way is to stick all the contacts and the required properties in a 2D array and look them up from there.

It would be neater with a structure type "Dim Type (F,N,L) cons(0) but I can't at the moment get it to reDim outside Sub Globals as in
"Dim Type (F,N,L) cons(PimColl.Count)" which gives a syntax error :( I'll ask Erel if this is possible.

B4X:
Dim cons(0,0) ' intial declaration in Sub Globals

Dim cons(PimColl.Count, 3) ' make it the right size
For i = 0 to PimColl.Count -1
  Con.Value = PimCol.GetItem(0)
  Cons(i,0) = con.FirstName 
  Cons(i,1) = con.NickName
  Cons(i,2) = con.LastName
Next

label1.text=con.(whichcontact, combobox.item(x)) ' look it up
 

taximania

Well-Known Member
Licensed User
Longtime User
Staring me in the face :signOops:

I'd already got an array for my top 12 contacts,
Dim Type(nam,num,text,img,tra) cont(13)
' Don't question numbers, eg: 13. It's how I work :) '

Never thought of setting another array for the rest of them.

Cheers Agraham :sign0188:
 
Last edited:
Top