>I have a class in which I have a few Tstring lists.
>
>I now want to access those string list by their name from  a sting the user 
>enters in a edit box.
>
>How do I do this?

Your program needs to correlate the string entered by the user to the object.
If you only have few, the simplest way would just be to use an if construct:

-------------------------
var
  SelectedStringList: TStrings;
  UserSelectedStringList: string;

{Assert: You assigned the string entered by the user to the variable 
UserSelectedStringList}

SelectedStringList:=nil;

if UserSelectedStringList = 'NameOfStringList1' then 
SelectedStringList:=StringList1
  else if UserSelectedStringList = 'NameOfStringList2' then 
SelectedStringList:=StringList2
  else if UserSelectedStringList = 'NameOfStringList3' then 
SelectedStringList:=StringList3
  else ShowMessage('Invalid StringList');

{Assert: SelectedStringList is now assigned}
if SelectedStringList <> nil then begin
 {Do your processing using SelectedStringList here}
  end;
-------------------------

If you have more than a few, you could use a TStringList where the strings in 
the list contain
the string the user enters and the Objects associated with each points to the 
TStrings object.

Glenn Lawler
www.incodesystems.com

Reply via email to