I am trying to run an HTML file that I have imported into the Solution Explorer. I don't know how to refer to documents in the Solution Explorer in code. How can I do that?
I am currently using this code, but it doesn't work:
process.start(".\help.html")
You need to set the HTML file to be copied to the output directory. Right-click on your file in the Solution Explorer:
Set the "Copy to Output Directory" property to "Copy if newer":
And finally, just run the file as usual:
Process.Start("help.html")
Related
I deleted the file Form1.vb on folder/explorer because I accidentally created it under MyProject in the solutions explorer. but when I tried to rebuild it I'm having below error already.
Severity Code Description Project File Line Suppression State
Error Unable to create a manifest resource name for "My Project\Form1.resx". Could not find file 'C:\Users......\My Project\Form1.vb'.
all data of files is stored in the solution itself, Go to Solution Explorer, Select the file
Either
1.) Right click the folder, Click Delete, Confirm Deletion Process if prompted.
2.) Left click the folder and hit the Delete key on your keyboard.
Do either of these will remove it from your solution and thus, the project. If you have folders being sync'd with git hub it will also update it this way, don't just straight up delete folders from the actual windows explorer though, this could cause pointer issues for reference.
I found the solution.
I created same file with same filename confirmed to replace this with the missing.
then added it again on "MyProject". Project -> Show All Files from the main menu.
I think what I needed was just the Project > show all files.
thank you to everyone who answered above it made me search for this
I am trying to use WinSCP to access a remote HTML file, and I do have root permission. However, if I open that HTML, it seems that all the sources and scripts are dysfunctional, e.g no images, buttons etc are loaded, and no js functions work. So how can I open a HTML using WinSCP so that all the sources are loaded and work properly? Thanks a lot.
I assume you "Open" the HTML file from a remote panel of WinSCP.
This makes WinSCP download the file to a temporary local folder and open the file from there.
As all the references to images and java script files are typically relative paths, they won't work from the temporary folder as the referenced files are not there. So it cannot work.
Either you need to download all files (including images and .js) to a local folder and open the HTML there.
Or you actually want to open the file from the server, via HTTP.
For that use the WinSCP extension "Generate HTTP URL".
I already have this code from another question on this website.
Help.ShowHelp(ParentForm,
("C:\Users\Beaudean\Desktop\Help.chm"),HelpNavigator.TableOfContents, Nothing)
That works fine except i need the location of the chm help file to point to "my.resources" where it exists because i need to install my program but in that code example it only works with strings?
Thanks you :)
You cannot make this work. The .chm help file viewer is an external program, hh.exe. It doesn't know anything about managed resources, it needs a .chm file on disk.
Setup your project so that the .chm file is available in your build directory. Project + Add Existing Item and pick your .chm file. Select the added file and set its Build property to Content (so it gets installed with the rest of your files) and its Copy to Output Directory to "Copy if Newer" (so it gets copied to your build directory).
And modify your code so it can always find that file:
Dim path = System.IO.Path.Combine(Application.StartupPath, "Help.chm")
Help.ShowHelp(ParentForm, path, HelpNavigator.TableOfContents)
I need to get VS application path.
Hi! In my windows forms application I had added a image file.
Now I want to get the full path of this image file.
Any idea how can i implement it?
As Cody Gray pointed out, if you have added the image as a resource, you can access it in code via the applicable image property in the My.Resources class.
However, if you have added the image file as just a regular file included in your project, you need to set its "Copy to Output Directory" property to either "Copy if newer" or "Copy Always". That way, the file will be copied to your project's bin folder when it is built. Then your code can find it by looking in the executable folder. You could just assume it's in the current directory, but it would be safer to use something like system.Reflection.Assembly.GetExecutingAssembly().Location to get the full path.
I have added an XML file (File.xml) into a project (I can see it in the Solution Explorer), it resides at the root directory level of the project i.e. the same level as the VB program (.vb), the bin directory and the References directory etc..
I try accessing it using XmlDocument.Load("File.xml") ... but it doesn't find it. I get
A first chance exception of type 'System.IO.FileNotFoundException' occurred in System.Xml.dll
Any idea where the file is or how I 'address' it?
Thanks for any help
Oliver
Is the file copied to the output directory? Click on the file, look at the properties in the VS editor, and set the "Build Action" to Content and "Copy to Output Directory" to either "Copy always" or "Copy if newer" (depending on what you need).
In the Publish property go to
Application Files --> Look for the XML file: If the publish status = Data File, then the File will be copied to the Application DATA folder.
If you want the xml to be inside the programs directory change the publish status to: Include. This will do the trick.
Try this:
XmlDocument.LoadXml(System.IO.Path.GetFullPath(Application.StartupPath & "\File.xml"))
It's worth a shot I guess. My question: is it possible to edit a file that's placed in the project?