Recent

Author Topic: [Solved] I can't figure out how to convert from AnsiString to TString  (Read 5476 times)

Trenatos

  • Hero Member
  • *****
  • Posts: 537
    • MarcusFernstrom.com
I've searched for some time now, but can't find a solution for this:

I have an array where I store file information, among them name.

fileList: Array of Array of string;

I grab the filename using the OpenDialog, save into a variable, use ExtractFilename to get the filename from the full path, save into the array, then try to update tabs in a TTabControl, at which point I get: Got "AnsiString", expected "TStrings"

My problem is that I can't figure out how to convert from AnsiString to TString.

theFilename := OpenDialog1.FileName;
SynEdit1.Lines.LoadFromFile(theFilename);
fileList[0][0] := ExtractFileName(theFilename);
fileList[0][1] := 'File-information';

theTabs.tabs := fileList[0][0];
« Last Edit: June 29, 2015, 01:56:46 pm by Trenatos »

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: I can't figure out how to convert from AnsiString to TString
« Reply #1 on: June 23, 2015, 09:28:42 pm »
TStrings class is an array of strings, AnsiString is a single string. TStrings has a Text property, which is a string.
« Last Edit: June 23, 2015, 09:36:02 pm by typo »

Trenatos

  • Hero Member
  • *****
  • Posts: 537
    • MarcusFernstrom.com
Re: I can't figure out how to convert from AnsiString to TString
« Reply #2 on: June 23, 2015, 09:46:51 pm »
Thanks Typo! That tidbit was all I needed, I can now proceed     :D

 

TinyPortal © 2005-2018