473,406 Members | 2,769 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,406 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 2147
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...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.