Solved

CommonDialog Open file

Posted on 2004-04-05
3
959 Views
Last Modified: 2010-08-05
How do you know if they have pressed cancel?
or closed the box?

Thanx in advance
0
Comment
Question by:intalex
  • 2
3 Comments
 
LVL 19

Expert Comment

by:BrianGEFF719
ID: 10756547
just do this...very simple

commondialog1.showopen
if commondialog1.filename = "" then
 msgbox "You pressed cancel!"
else
 msgbox "You picked: " & commondialog1.filename
end if


simple as that
-brian
0
 
LVL 19

Expert Comment

by:BrianGEFF719
ID: 10756554
the only condition in which Commondialog1.filename = "" is when the user presses cancel, so simply check to see if its empty will let you know if the user hit cancel.


-Brian
0
 
LVL 1

Accepted Solution

by:
burnttime earned 20 total points
ID: 10756644
If you have the commondialog on another form and when you press cancel the result still comes up as the opened path so when you press cancel the result isnt blank renew the ocx i had a problem with that a while back and for some reason that work???

If not just:

CommonDialog.Showopen
If CommonDialog.Filename <> "" Then
' Code here to do what ever with the directory
Else: ' Maybe message box saying error if you need a path
End if
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

708 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

15 Experts available now in Live!

Get 1:1 Help Now