stringlistcontainer Values property
Return to Introduction  Previous page  Next page
Applies to
acStringListContainer component.  

Declaration
property Values[Index: Integer]: String;  

Description
The Values is the run-time only property, which can be used to read or modify the second part of string, separated on 2 parts with some character of string specified in NVSeparator property. The Values property should be used only if each string of the list is organized in the manner of "name=value" and allows to retreive and modify the "values" (as well as Names property gives an access to "names").  
 
With the Values you can access a second part of a specific string ("value" part, after separator), to read or modify the "value" at a particular position. Index gives the position of the string, where 0 is the position of the first string, 1 is the position of the second string, and so on ("Count - 1" is the position of last string in the list).  
 
To locate a particular string in the list, call IndexOf method, or use IndexOfName and IndexOfValue methods if the string list is the list of "names=values" (where each string is some "name" and "value", separated with some character).  
 
tip For example, if the fist string in the list is "hello=world", and the separator sign is "=", then reading of the Values[0] at run-time will returns string "world".  

Example (demonstrates how to retrieve the first part of string before the separator specified in the NVSeparator property)
procedure TForm1.Button1Click(Sender: TObject);  
begin  
  // retreives the "value", by index entered in some Edit box, and displays it in some Label  
  Label1.Caption := acStringListContainer1.Values[StrToIntDef(Edit1.Text, 0)];  
 
  // modifies the "name" part of the first string  
  acStringListContainer1.Names[0] := 'Hello';  
  // modifies the "value" part of the first string  
  acStringListContainer1.Values[0] := 'World!';  
 
  // the example above is the same as example below, if NVSeparator property is '='  
  acStringListContainer1.Strings[0] := 'Hello=World!';  
end;  

See also
Names, Strings and NVSeparator properties;  
LoadFromRegistry and StoreToRegistry methods.