how do i check if there is no filename?

Posted on 1998-02-13
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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

914 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now