Thread: AnsiString to TString

  1. #1
    Registered User Pupukea's Avatar
    Join Date
    May 2003
    Posts
    1

    AnsiString to TString

    Hi,

    A method I am calling returns an AnsiString ( from a text file), and has to be presented in a 'memo' on a form in Borland....only prob is, it only accepts Tstrings and I cant find a method to convert..??

    I cant access the method itself, so need to convert once it is returned...

    ....as you can tell im new to Borland, so any help appreciated...

    THX - I.A. - Mark

  2. #2
    Veni Vidi Vice
    Join Date
    Aug 2001
    Posts
    343
    I donīt remember the correct syntax but I think there is a property in TMemo called TString. In that property you could acces each line with a index that returns a line in TMemo.

    Se the borland helper. There is everything you need to know .
    01000111011011110110111101100100 011101000110100001101001011011100110011101110011 01100100011011110110111001110100 01100011011011110110110101100101 01100101011000010111100101110011 0110100101101110 01101100011010010110011001100101
    Good things donīt come easy in life!!!

  3. #3
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    You could use the WinAPI directly and an #ifdef UNICODE directive, but that would be quite complicated - there should be a better way.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  4. #4
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    TStrings is essentially a list of AnsiStrings. The TMemo property that ripper was getting at is Lines, so the code should be something like this:

    Memo1->Lines->Add(myString);

  5. #5
    Registered User
    Join Date
    Apr 2003
    Posts
    6
    good place to learn builder 6
    http://www.functionx.com/bcb/

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. TString manipulation...
    By McClane77 in forum Windows Programming
    Replies: 4
    Last Post: 12-17-2003, 11:16 PM
  2. AnsiString versus char *
    By Zahl in forum C++ Programming
    Replies: 35
    Last Post: 10-16-2002, 08:38 PM
  3. How do I play an MP3?
    By Hunter2 in forum Windows Programming
    Replies: 28
    Last Post: 05-20-2002, 08:49 PM
  4. Tstring 's and their data types
    By tegwin in forum C++ Programming
    Replies: 2
    Last Post: 03-06-2002, 05:01 PM
  5. Familiar with AnsiString??
    By tegwin in forum C++ Programming
    Replies: 3
    Last Post: 02-28-2002, 01:20 PM