473,322 Members | 1,417 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,322 software developers and data experts.

open a file

3
here is a easy question for you guys:

How do I open a file? I don't mean import it in vb, I want to open it using the default program.
example: I want to open a mp3 using windows media player when I ask my program to do so...


thanks
Nov 17 '08 #1
9 1359
lotus18
866 512MB
You can use Shell command for that : )


Rey Sean
Nov 18 '08 #2
tido
3
thanks, with some research I learned how to use shell
Nov 18 '08 #3
Hi there.

There is an easy way to open no matter what type is your file.

Expand|Select|Wrap|Line Numbers
  1.  
  2. Process.Start("mymusic.mp3")
  3.  
  4. Process.Start("myarq.pdf")
  5.  
  6. Process.Start("mySpreadSheet.xls")
  7.  
  8.  
I hope this help you.
Nov 18 '08 #4
lotus18
866 512MB
Hi there.

There is an easy way to open no matter what type is your file.

Expand|Select|Wrap|Line Numbers
  1.  
  2. Process.Start("mymusic.mp3")
  3.  
  4. Process.Start("myarq.pdf")
  5.  
  6. Process.Start("mySpreadSheet.xls")
  7.  
  8.  
I hope this help you.
This will only work on .net project. If the OP is using vb 6, shell command will do.


Rey Sean
Nov 18 '08 #5
smartchap
236 100+
Use the following code:

ShellExecute 0&, "OPEN", "E:\Songs\14-Race\05 - Zara Zara Touch Me (Asian RnB Mix).mp3", "", "", 1

In this replace file name with your filename. Also for this is required:

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
Nov 19 '08 #6
This will only work on .net project. If the OP is using vb 6, shell command will do.


Rey Sean
Hi I'm not using dot.net project. I'm using the free version of VB 2008. Looks like Visual Studio but its not. Either way thank you.
Nov 19 '08 #7
smartchap
236 100+
Dear rpicilli
I also am not using vb.net. I am using VB6 and in that it works fine. In vb 2008 u can check and I think it should work.
Nov 20 '08 #8
lotus18
866 512MB
Hi I'm not using dot.net project. I'm using the free version of VB 2008. Looks like Visual Studio but its not. Either way thank you.
What I meant is .NET and not actually "project". Sorry for the previous post : )


Rey Sean
Nov 20 '08 #9
lotus18
866 512MB
Dear rpicilli
I also am not using vb.net. I am using VB6 and in that it works fine. In vb 2008 u can check and I think it should work.
Try to switch to vb .NET and you will be amazed of this language. I swear : )


Rey Sean
Nov 20 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: yanivmad | last post by:
hi I like to ask if there any option to control the html files?!? I have some HTML files at my web site that use one "Help.htm" file for all the pages {I use the "window.open(.... " option at...
9
by: Charles F McDevitt | last post by:
I'm trying to upgrade some old code that used old iostreams. At one place in the code, I have a path/filename in a wchar_t string (unicode utf-16). I need to open an ifstream to that file. ...
6
by: Dino Buljubasic | last post by:
My application creates some temporary files that are deleted when my application terminates. However, if a temp file is open, it will not be deleted and application will crash. How can I...
2
by: Mattbooty | last post by:
Hello, Not sure if anyone else has seen this bug, but I have a form where the entire form is covered with a picturebox. The picturebox has a mouseup event. I also have an open file dialog for...
6
by: qysbc | last post by:
I have a web page and there is a link to open a TIFF file. The way I do it is to have the server code open a binary stream, set the content type to "image/tiff" and call Response.BinaryWrite. On...
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...
6
by: Moumen VB.NET 2003/2005 Developer | last post by:
How can I detect if a file sitting on a network drive is still open by another application? This application resides on another machine on the network? I am using VB.NET 2003 Your help is...
5
by: Ryan Liu | last post by:
Hi, Both way works, I'd just ask some experts which way is better? My application creates a log file daily. Now each time when I write a log, I will open the file and append to the end....
6
by: Ros | last post by:
There are 10 files in the folder. I wish to process all the files one by one. But if the files are open or some processing is going on them then I do not want to disturb that process. In that case...
0
by: Ofelia | last post by:
Hi, I'm new to this forum and to Perl language but I would like to ask for your help. I'm working in Linux and the files I need to process are in the format “file.gz”. I created a script which...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.