By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,515 Members | 1,033 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,515 IT Pros & Developers. It's quick & easy.

Opening a file... any file (cross-posted microsoft.public.dotnet.languages.vb;microsoft.pub lic.dotnet.framework.windowsforms.controls)

P: n/a
Hello

I am trying to set up an open file routine that will open whatever files
name is passed with its correct associated application. I have done this
(quite easilly) before in VBA and am able to open pretty much anything I
want using shell execute etc.

I tried importing the old code into VB dotNet and it executes fine but just
doesn't actually open the file. No errors returned at all (?).

I also tried using an openFileDialog and can get the filename etc. but can't
figure out how to actually open the file :@(

Anyone got any sample code or suggestions? This is hurting my head big time.
Should be so simple...

TIA

Mark
Nov 21 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a
Sorry folks... Found it on Google minutes after my last post.

Used

System.Diagnostics.Process.Start("filePath.etc")

and it works just fine :@)
Nov 21 '05 #2

P: n/a

Look up the System.Diagnostics.Process object...

"Mark" <ma**@tencdf.com> wrote in message
news:Iv*****************@newsfe5-gui.ntli.net...
Hello

I am trying to set up an open file routine that will open whatever files
name is passed with its correct associated application. I have done this
(quite easilly) before in VBA and am able to open pretty much anything I
want using shell execute etc.

I tried importing the old code into VB dotNet and it executes fine but
just doesn't actually open the file. No errors returned at all (?).

I also tried using an openFileDialog and can get the filename etc. but
can't figure out how to actually open the file :@(

Anyone got any sample code or suggestions? This is hurting my head big
time. Should be so simple...

TIA

Mark

Nov 21 '05 #3

P: n/a
Thanks Robin...

Just found it :@)

Mark
Nov 21 '05 #4

P: n/a
Mark,

The OpenFileDialog will only help you get the Filename. You have to write
the code yourself to open the file. There are many ways in which you can
accomplish File I/O in VB.NET. Here is a link which might help you.

http://msdn.microsoft.com/library/de...albasicnet.asp
Nov 21 '05 #5

P: n/a
Mark,

I thought I would find this thousand times and could copy it, however this
is copied from a German entwickler newsgroup.

\\\
using System.Diagnostics;
..
..
Process.Start(@"C:\foo\bar.doc*");
///

I hope this helps,

Cor
Nov 21 '05 #6

P: n/a
Thanks very much Sarika :@)

Mark
http://msdn.microsoft.com/library/de...albasicnet.asp

Nov 21 '05 #7

P: n/a
Thanks Cor... got it :@)

Mark
Nov 21 '05 #8

P: n/a
"Mark" <ma**@tencdf.com> schrieb:
I am trying to set up an open file routine that will open whatever files
name is passed with its correct associated application. I have done this
(quite easilly) before in VBA and am able to open pretty much anything I
want using shell execute etc.


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

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 21 '05 #9

P: n/a
Thanks Herfried

Mark
Nov 21 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.