Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 553
  • Last Modified:

Common Dialog filter for only folders

Hello,
I am using the common dialog to allow the user to navigate to the folder where their data is stored.  I only want to allow them to see and select folders.  How do I write this in the filter command due to folders not having an extension?
 ex. commonDialog.Filter = "*.exe|*.exe"

thanks in advance!
Sarah
0
sarahjackel
Asked:
sarahjackel
  • 3
  • 2
  • 2
  • +1
1 Solution
 
gbzhhuCommented:
You will have to use browseforfolder code following
0
 
Erick37Commented:
Use the Browse for Folders API:

Implementing the Browse For Folders Dialog
http://vbnet.mvps.org/code/browse/browsefolders.htm
0
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.

 
sarahjackelAuthor Commented:
sorry...I forgot to add that I am writing this in VBA.  I tried the code in the links, but I get an eror on the line:
.hWndOwner = Me.hWnd

any other suggestions?

sarah
0
 
Erick37Commented:
You can use the desktop window handle:

Private Declare Function GetDesktopWindow Lib "user32" () As Long

'======================

.hWndOwner = GetDesktopWindow
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
You can just put 0 (zero) in for owner:

    .hOwner = 0
0
 
gbzhhuCommented:
Erick beat me to it!!
0
 
sarahjackelAuthor Commented:
Terrific!  Thank you all for your very fast answers!
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
By the way sarahjackel,

I don't want any points for this question as it has been more than adequately answered by Erick37 and gbzhhu.

I just happened to see your comment and answered at the same time as Erick37.

=)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now