Procedure TForm1. N3Click (Sender: TObject);
The begin
If bj. Lines. The Text="' then
MessageBox (Handle, 'save the content cannot be empty', 'Warning:', MB_OK or MB_ICONWARNING)
The else
The begin
DlgSave1. Execute;
Bj. Lines. SaveToFile (dlgSave1 FileName);
The end;
The end;
CodePudding user response:
DlgSave1. Execute;Bj. Lines. SaveToFile (dlgSave1 FileName);
-->
If dlgSave1. Execute then
Bj. Lines. SaveToFile (dlgSave1 FileName);
CodePudding user response:
procedure TForm1. Button1Click (Sender: TObject);
The begin
If Memo1. Text="' then
MessageBox (Handle, 'save the content cannot be empty', 'Warning:', MB_OK or MB_ICONWARNING)
The else begin
If MessageBox (0, 'agreed to save,' tip 'MB_OKCANCEL)=idOK then
If SaveDialog1. Execute then
Memo1. Lines. SaveToFile (SaveDialog1 FileName);
The end;
The end;
The code above, should solve the problem,
CodePudding user response:
If dlgSave1. Execute thenBj. Lines. SaveToFile (dlgSave1 FileName);
CodePudding user response:
Upstairs have mentioned a few prawns, must first determine whether dlgSave1 execution, the save is to perform,CodePudding user response:
The key technology is to determine whether to implement save
If SaveDialog1. Execute then
CodePudding user response:
![](https://img.codepudding.com/202009/109882271021261.gif)
If SaveDialog1. Execute then
The Begin
//handle code written here, finally using showmessage statement such as pop-up prompt dialog,
End
CodePudding user response:
Should be written using standard code, everyone is so beneficial to practice!CodePudding user response:
Procedure TForm1. Button1Click (Sender: TObject);The begin
If Memo1. Text="' then
The begin
MessageBox (Handle, 'save the content cannot be empty', 'Warning:', MB_OK or MB_ICONWARNING);
exit;
The end;
If SaveDialog1. Execute then
If SaveDialog1. The FileName=' 'then//no input file name
The Exit;
If MessageBox (0, 'agreed to save,' tip 'MB_OKCANCEL)=idOK then
Try
Memo1. Lines. SaveToFile (SaveDialog1 FileName);
MessageBox (Handle, 'save success', 'Warning: ", MB_OK or MB_ICONWARNING);
Except,
MessageBox (Handle, 'save failed', 'Warning: ", MB_OK or MB_ICONWARNING);
The end;
The end;