473,394 Members | 1,700 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

opening File/Dir with default application (also without extension)

Hi,

From my VB.NET 2005 application I need to be able to open Files an
Directory's with their default application:
- A word-doc must open in word
- A excell-document in Excel etc
- in case it's a folder it must open the Folder

No problem there, but when I want to open a file without extension, that
hasn't offcourse a default application, I'm getting an error. I'd prefer to
have the "Choose Program"-dialog.

Any idea how I should open the files to have this?

Thanks a lot in advance,

Pieter
I'm using this now:

Dim prcLogin As New Process
Try
prcLogin.StartInfo.UseShellExecute = True
prcLogin.StartInfo.RedirectStandardOutput = False
prcLogin.StartInfo.FileName = strName
If strArg <> "" Then
prcLogin.StartInfo.Arguments = strArg
End If
prcLogin.Start()
Catch ex As Exception
MessageBox.Show("Can't open the file!", MessageBoxButtons.OK,
MessageBoxIcon.Error) '-> happens when the file doesn't have an
extension....
End Try
prcLogin.Close()
Nov 23 '05 #1
4 2637
Try using:
System.Diagnostics.Process.Start(FileName)

"Pieter" wrote:
Hi,

From my VB.NET 2005 application I need to be able to open Files an
Directory's with their default application:
- A word-doc must open in word
- A excell-document in Excel etc
- in case it's a folder it must open the Folder

No problem there, but when I want to open a file without extension, that
hasn't offcourse a default application, I'm getting an error. I'd prefer to
have the "Choose Program"-dialog.

Any idea how I should open the files to have this?

Thanks a lot in advance,

Pieter
I'm using this now:

Dim prcLogin As New Process
Try
prcLogin.StartInfo.UseShellExecute = True
prcLogin.StartInfo.RedirectStandardOutput = False
prcLogin.StartInfo.FileName = strName
If strArg <> "" Then
prcLogin.StartInfo.Arguments = strArg
End If
prcLogin.Start()
Catch ex As Exception
MessageBox.Show("Can't open the file!", MessageBoxButtons.OK,
MessageBoxIcon.Error) '-> happens when the file doesn't have an
extension....
End Try
prcLogin.Close()

Nov 23 '05 #2
"Pieter" <pi**********@hotmail.com> schrieb:
From my VB.NET 2005 application I need to be able to open Files an
Directory's with their default application:
- A word-doc must open in word
- A excell-document in Excel etc
- in case it's a folder it must open the Folder

No problem there, but when I want to open a file without extension, that
hasn't offcourse a default application, I'm getting an error. I'd prefer
to have the "Choose Program"-dialog.


Opening files, applications, Web documents, and the mail client
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=openfileappwebpage&lang=en>

+

Displaying the "Open with..." dialog
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=openwithdialog&lang=en>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 23 '05 #3
Thanks Herfried! That was exactly waht I was looking for!

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:ep**************@TK2MSFTNGP15.phx.gbl...
"Pieter" <pi**********@hotmail.com> schrieb:
From my VB.NET 2005 application I need to be able to open Files an
Directory's with their default application:
- A word-doc must open in word
- A excell-document in Excel etc
- in case it's a folder it must open the Folder

No problem there, but when I want to open a file without extension, that
hasn't offcourse a default application, I'm getting an error. I'd prefer
to have the "Choose Program"-dialog.


Opening files, applications, Web documents, and the mail client
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=openfileappwebpage&lang=en>

+

Displaying the "Open with..." dialog
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=openwithdialog&lang=en>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 23 '05 #4
td
This works for me!
Thanks Simon
Terry

"Simon" wrote:
Try using:
System.Diagnostics.Process.Start(FileName)

"Pieter" wrote:
Hi,

From my VB.NET 2005 application I need to be able to open Files an
Directory's with their default application:
- A word-doc must open in word
- A excell-document in Excel etc
- in case it's a folder it must open the Folder

No problem there, but when I want to open a file without extension, that
hasn't offcourse a default application, I'm getting an error. I'd prefer to
have the "Choose Program"-dialog.

Any idea how I should open the files to have this?

Thanks a lot in advance,

Pieter
I'm using this now:

Dim prcLogin As New Process
Try
prcLogin.StartInfo.UseShellExecute = True
prcLogin.StartInfo.RedirectStandardOutput = False
prcLogin.StartInfo.FileName = strName
If strArg <> "" Then
prcLogin.StartInfo.Arguments = strArg
End If
prcLogin.Start()
Catch ex As Exception
MessageBox.Show("Can't open the file!", MessageBoxButtons.OK,
MessageBoxIcon.Error) '-> happens when the file doesn't have an
extension....
End Try
prcLogin.Close()

Jan 19 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: D. Alvarado | last post by:
Hello, I am trying to open a window containing an image and I would like the image to be flush against the window -- i.e. have no padding or border. Can I make this happen with a single call to a...
4
by: David Allison | last post by:
I am looking to open my MDE Application using the DB files associated with the application I have created. My application is using a non descript three digit extension that is related to the...
2
by: Matt Hamilton | last post by:
I have an application page with a datagrid with a checkbox on each row. The user should check the rows they want to modify and then click a button. When the button is clicked, I have a Click...
16
by: iwdu15 | last post by:
how can i open a file i saved and place the info into different text boxes?
4
by: Pieter | last post by:
Hi, From my VB.NET 2005 application I need to be able to open Files an Directory's with their default application: - A word-doc must open in word - A excell-document in Excel etc - in case...
2
by: OutdoorGuy | last post by:
Greetings, I have a "newbie" question in relation to opening files from C#. I have a Windows form where I allow the user to type in a file extension in a text box (e.g., "xls"). I then take...
1
AdrianH
by: AdrianH | last post by:
Assumptions I am assuming that you know or are capable of looking up the functions I am to describe here and have some remedial understanding of C programming. FYI Although I have called this...
7
by: Abhi | last post by:
Hi, I want to open a File with unknown Extension using C#. What i want is i do System.Diagnostics.Process.Start("FileName"); Now if File is associated with any program then the File with open...
26
by: Don Calloway | last post by:
I have created a <filename>.db1 (where <filenameis the name given to the database) Access database that is being used in multi-user mode. When the <filename>.db1 file is opened by a user, the...
2
by: =?Utf-8?B?RXRoYW4gU3RyYXVzcw==?= | last post by:
I am (still) relatively new to Windows applications, most of my experience has been Web based, and I am confused about what exactly happens when the Main() method is called and how to manipulate...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.