?
Solved

Can't Open CDL File wo Right Click

Posted on 2013-12-13
10
Medium Priority
?
410 Views
Last Modified: 2013-12-31
Is there a setting that I'm missing?  When I try to open a file via the browse common dialog object the window just closes unless I right click on the file>Open.  Is there  setting that I am missing?
0
Comment
Question by:Bob Schneider
[X]
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
  • 4
  • 3
10 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 39748316
I don't understand what you are working with, and your topics include both VB6 (VB classic), and VB.NET.
0
 
LVL 14

Accepted Solution

by:
Shiju Sasidharan earned 2000 total points
ID: 39748364
When you open file using Common Dialog Window, it will close after you select the file.
You need to capture the selected file name using a local variable or some other way.

See this url for more reference
http://www.tutorialspoint.com/vb.net/vb.net_openfile_dialog.htm
0
 

Author Comment

by:Bob Schneider
ID: 39749020
I apologize for re-visiting this but I have no idea how to actually open the file selected without right clicking and use the "Open" item.  For instance, I want to open a word document from the open file dialog.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 14

Expert Comment

by:Shiju Sasidharan
ID: 39749041
Not sure, this is what exactly you are looking for.
You could set Filter property to filter Doc files alone. After that you dont need to right click just select the doc file and hit open button

// Set filter options and filter index.
 OpenFileDialog1.Filter = "Doc Files (*.Doc)|*.doc|All Files (*.*)|*.*"
 OpenFileDialog1.FilterIndex = 1
0
 

Author Comment

by:Bob Schneider
ID: 39749043
I believe I have that set up but when I click on a file to open the dialog window closes and does not open the file.
0
 
LVL 14

Expert Comment

by:Shiju Sasidharan
ID: 39749050
Okay. Do you want to open the file in MS Word when you open from Open dialog box?
I assume you have written a .Net application and launching Common Dialog window from there.
0
 

Author Comment

by:Bob Schneider
ID: 39749061
I am using vb6, not .NET.  It could be a word file or a txt file.  Are you saying the file has to be "rebuilt" to open it?
0
 
LVL 14

Expert Comment

by:Shiju Sasidharan
ID: 39749086
Got it.

Add this API call as the first line in your form or module. if using "Option Explicit" paste this code right after that.

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Const SW_SHOWNORMAL = 1




Now use the following code where you call the Open Dialog Window.


CommonDialog.Filter = "Doc Files(*.doc)|*.doc|All files (*.*)|*.*"
CommonDialog.DefaultExt = "doc"
CommonDialog.DialogTitle = "Select File"
CommonDialog.ShowOpen
Dim strFileName As String

strFileName  = CommonDialog.FileName

ShellExecute hWnd, "open",  strFileName  ,  vbNullString, vbNullString, SW_SHOWNORMAL


Reference http://www.vb-helper.com/howto_shellexecute.html
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
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…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Suggested Courses

752 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