I've created my own application in VB.NET that saves its documents into a file with it's own custom extension (.eds).
Assuming that I've properly associated the file extension with my application, how do I actually handle the processing of the selected file within my application when I double click on the file in File Explorer?
Do I grab an argsc/argsv variable in my Application.Load() method or is it something else?
Try this article but short answer is My.Application.CommandLineArgs
Related
I'm using MS Access 2003 for Special and old problems with the .mdb project
I want to embed my files like .txt or .exe or .pdf and run them at runtime or write that on disk.
What have I tried :
enter image description here
I don't know what's the code to do what I need I couldn't find my solution on internet.
Private Sub Form_Load()
'Me.OLEUnbound2.Application.Run
Dim obj As Object
Set obj = Me.OLEBound1.Object
'obj.DoVerb (acPrimaryVerb)
End Sub
Update:
I wrote a C# program called BMH.exe, which I open and run through Access, but I want this file to be in my source in any way possible so that the user does not have to place this file next to the program or somewhere It has Windows,
I also don't want to do things like downloading from the site, creating an installation file, I just want to access this program in any possible way through the embedded file itself, which is in the form of OLE Object and from the Packager Shell class. Write the object to a specific address or run it directly from Access itself
You can save the file as attachment in attachement field. If it will not accept an .exe file switch the extension and switch it back when exporting, you can do all this with code. Alternatively you can store the file as binary in an Ole field.
I'm using the following the code to open a file that resides elsewhere on the computer:
System.Diagnostics.Process.Start(PathToOpen)
Where PathToOpen is the full address to the file I wish to open. This appears to work as intended for any file type that has an application installed that can open the file.
Whilst this works OK, if the file is on a networked drive, I want my VB.Net code to check if the file is currently in use, if so display a message. Currently what happens is if a second user tries to open the file, it opens read-only (a word file for example) which is handled outside of my application. I want to intercept before the file is opened and stop the process there.
Is this possible at all?
You are basically asking if it's possible to monitor files on a system that doesn't even belong to you ?
Word does know about a file already in use because it creates a hidden file next to the one you open. if there is already a hidden file, it means the file is already in use.
Other applications use different ways of knowing if a file they can use is already opened somewhere else.
In order to do what you want to do, you need to know how all the applications handle this problem...
A possible solution would be for you to create a small hidden file next to the file the user wants to open (just like MS Word does). Only problem, you need to destroy the file when it's closed by the user, and you have no way of knowing that...
I saved the datawindow in PDF format using SAVEAS method and I want to open the saved file in Acrobat reader. But in web application after save as method using Downloadfile() i'm able to open it. I think using OLEobject it is possile but i don't know how to do that. Any suggestions ?
If you just want to view the document (ie, no interaction with your PowerBuilder application) you can use the 'RUN' command.
Example:
RUN('C:\temp\mydoc.pdf')
This will open the file using whichever program is associated with .pdf files within your Windows settings.
We simply use the Internet context service to open the PDF URL:
inet l_inet
string ls_url
// set ls_url to the URL to open
GetContextService("Internet", l_inet)
l_inet.HyperlinkToURL(ls_url)
Using VS 2013 and vb.
I have a web page and on a button click i would like file explorer to open so the user can navigate to a folder location and highlight a file. The web application will then get the path and filename of the file. Just to be clear I dont want to open the file I just want the details.
I cant seem to find a way of doing this, can you help?
UPDATE
Apologies perhaps I havent explained my self very well.
This is so a user can reference a document saved on a file share with a particular audit (the web page is for recording audits). Therefore they will click a button and file explorer will open. They will navigate to a folder (will be different everytime) and select a file. File explorer will then close and the web application will know the path of the file and its name. I can then use this to create a link on the web page to that document.
For getting directory path use; System.IO.Path.GetDirectoryName(path)
For file name System.IO.Path.GetFileName(path) or System.IO.Path.GetFileNameWithoutExtension(path)
more info is available at http://www.dotnetperls.com/path
Use path.getFullPath() method to get the file path as a string.
If you want to get the file name only use path.getFileName() method.
I am working on silverlight application and I want to save my file in a particular folder through savefile dialog box. But I am not able to save it.
And also I want to open it, let's say through open - dialog box.
How can I do it?
Thanks..
You can open/save files using the open/save file dialogs even outside the isolated storage for the application. Search "silverlight savefiledialog" and you'll find many examples.