Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


how do i check if there is no filename?

Posted on 1998-02-13
Medium Priority
Last Modified: 2010-04-04
how do i check if there is no filename entered in the
open file dialog and the user just press the cancel button
in the open file dialog?
procedure TEditForm.Open(const FileName: string);
 PathName := FileName;
 Editor.SelStart := 0; <- error here when the user presses the cancel button in open file dialog...

 Caption := ExtractFileName(PathName);
 Editor.Modified := False;
Question by:superboy
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

puppy earned 10 total points
ID: 1359184
hi superboy,
try this:
procedure TForm1.Button1Click(Sender: TObject);
label ok,nofile;
if opendialog1.filename = '' then goto nofile
else goto ok;

Author Comment

ID: 1359185
i solved this problem already..i set a boolean flag to true when opening a file and this affects the canel button..the boolean flag is fileopened..thanx anyway..

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question