Click here to Skip to main content
15,888,984 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
What I need to do is send a file to a visual Studio (VB) written application. The save dialog is activated by selecting the save button on the web page. I am presented with a choice of saving the file to disk OR sending it to an application of my choice.

:confused: Can you tell me what it takes to have the file be read into a Visual basic application as a data file? In other words how do I program a VB app to accept such a file sent to it? I'm having a hard time finding out how to do this with my own research. :confused:

The action does not have to activate the program since it will already be running. But I do need to read it into a variable object somehow. The file stream will also be coming in from the internet through my browser if that makes a difference.

Thanks.
Posted

1 solution

I'm assuming you mean when saving a file off the internet when it asks "Save this File", or "Open with ..." you want to select your application.

This works by the standard Windows file association (File extensions, ie. gif, jpg, xls etc.).

Depending on the way the file association is set up with your application, it'll use DDE (I'm afraid I don't know much about DDE though), or it will pass the file name as a command line parameter to the program.

In VB6, the commandline parameters can be read by the Command() function
 
Share this answer
 
Comments
Manfred Rudolf Bihy 26-Feb-11 15:13pm    
Moved to a comment on OP's behalf:
[Nobia wrote]
Thank You. I am familiar with both points you raised. However I am currently writing the Application so don't have an executable to associate with an extension. Unless I can make that link with the Debug file thats created when running the App from with in Visual Studio? In any case I still would need to know how to handle the file on the programming side once I did set that association outside of Visual Studio. I would also like to be able to send a file of any extension if possible.

What I am trying to do is avoid the 'Save to disk -- load into program' step.

I have intermediate experience with Vb but only in file based - data handling, so this is outside my usual experience. I may not need an actual code example (though that would be faster) but if someone could at a minimum point me to some documentation or proper keywords for more research.
MarqW 28-Feb-11 9:47am    
The only way to avoid the "Save to disk" command is by creating a plugin per browser. Even then the user may request a prompt from the browser anyway (security against malware)

Another way is writing an ActiveX control and embed that on the webpage. You can pass parameters via the page HTML.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900