Hola, otra manera de hacerlo, si es que entiendo bien tu pregunta y lo que quieres es meter el texto de los 7 Memos en un mismo .txtComo ejemplo, añadimos al Form1 de un nuevo proyecto 7 Memos (Memo1..Memo7), un par de Botones (btnGuardar, btnCargar) y la cabecera #include <Inifiles.hpp>:
Al boton Guardar le asignamos el siguiente código:
code:
//---------------------------------------------------------------------------
void __fastcall TForm1::btnGuardarClick(TObject *Sender)
{
TIniFile *Ini = new TIniFile("c:\\MiFichero.txt");
for (int i=1; i<=7; i++)
{
String Str = (String) "Memo" + i;
TMemo *Memo = dynamic_cast<TMemo*>(FindComponent(Str));
if (Memo)
{
Ini->WriteString("Memos", Str,
(String) "\"" + Memo->Lines->CommaText + "\"");
}
}
delete Ini;
}
//---------------------------------------------------------------------------
Y al boton Cargar:
code:
//---------------------------------------------------------------------------
void __fastcall TForm1::btnCargarClick(TObject *Sender)
{
TIniFile *Ini = new TIniFile("c:\\MiFichero.txt");
for (int i=1; i<=7; i++)
{
String Str = (String) "Memo" + i;
TMemo *Memo = dynamic_cast<TMemo*>(FindComponent(Str));
if (Memo)
Memo->Lines->CommaText = Ini->ReadString("Memos", Str, "");
}
delete Ini;
}
//---------------------------------------------------------------------------
No lo he probado mucho, aunque en lo poco que he probado ha funcionado sin problemas, ya nos contaras, espero que te sirva...
Saludos.