Assistance for delphi

Status
Not open for further replies.

NightLightW

Active Member
173
2011
23
0
Hello,
I have one problem in delphi with saving some text. I want to save text from memo
and i want this text to save in .txt format. I try to find help with google but....
i know i need to insert SaveDialogs , to define dialog variable, Give the dialog a title,Set the default extension, i know code for that but how to get text from memo and save i dont know:'(

Can you help me?

if i post this in wrong forum sorry i dont know where is correct to post
 
3 comments
Memo1.lines.SaveToFile('C:\...\FILENAME.txt');

You can change the path and filename, or add a save dialog.

Memo1.Lines.SaveToFile(SaveDialog1.FileName);

you can do

If SaveDialog1.Execute then begin
// your code here
end;
 
Thanks for help StillCyco
dACr4G.png

If SaveDialog1.Execute then begin
// your code here
[what can i inset here ?]

end;

I try with this code but i cant save
begin
// Create the save dialog object - assign to our save dialog variable
saveDialog := TSaveDialog.Create(self);

// Give the dialog a title
saveDialog.Title := 'Save your text or word file';

// Set up the starting directory to be the current one
saveDialog.InitialDir := GetCurrentDir;

// Allow only .txt and .doc file types to be saved
saveDialog.Filter := 'Text file|*.txt|Word file|*.doc';

// Set the default extension
saveDialog.DefaultExt := 'txt';

// Select text files as the starting filter type
saveDialog.FilterIndex := 1;

// Display the open file dialog
if saveDialog.Execute
then ShowMessage('File : '+saveDialog.FileName)
else ShowMessage('Save file was cancelled');

// Free up the dialog
saveDialog.Free;
end;
This is how look my form
JNuJjm.png
 
Last edited:
Hey i fix this problem with this code
Code:
procedure TForm1.Button5Click(Sender: TObject);

begin
if SaveDialog1.Execute then
  BBCodeoutput.Lines.SaveToFile(SaveDialog1.FileName);
  end;
  

procedure TForm1.FormCreate(Sender: TObject);
begin
SaveDialog1.Filter := 'Text files (*.txt)|*.TXT';
end;
And here is final product
Code:
http://goo.gl/xEn1X
But i need to make more better saving files in txt format now you need to write ex. VA - Malubi Vol.3 (2012).txt is not auto
 
Status
Not open for further replies.
Back
Top