Adding an image to a solution which won't compile and which can be navigated to - vb.net

It often happens that I draw diagrams of how something is designed in my application, for example a tree-like structure in a dialog window with several steps that the user can answer by choosing yes and no.
Is it possible to include this image in my solution but not compile it?
And would it be possible to add a link to the image in my code so that I can simply click on the link, and it would open up the image for me in VS?
This way I wouldn't have to locate it on my disk.
Thank you very much!

If you want to add an existing file to your project then right-click on your project in the Solution Explorer and select 'Add > Existing item'. Set the Build Action to Content and the Copy to output directory to Copy always or Copy if newer. The file will then be copied to the same folder as the EXE when you build. You can access such a file at run time using a path like this:
Dim filePath = IO.Path.Combine(Application.StartupPath, "filename.ext")

Related

change of location of the database dynamically in app running

Try to make my app read the ms-access database from shortcut of my database it failed to read, so try to change the location of database dynamically ( there is an option in the app to move the database to drop-box folder and create a shortcut to that database in app folder )
try to make an shortcut to the moved ms-database
the app to read the database or to change the location of database dynamically
First of all, you should create a folder with a clear name in your VB.Net application path, namely inside the project Debug folder, let's name that folder as "MyProjFiles", so it will be in this path: ProjectFolderName\bin\Debug\MyProjFiles
Put your whole projects files inside our lovely folder MyProjFiles, including all types of your attachments: database, images, sounds, files, etc.
Call your database or whatever of those attachments files in addition to our \MyProjFiles\ using this method: My.Computer.FileSystem.CurrentDirectory & "\MyProjFiles\YourFilesPathHere.EXT".
Now, the whole path will be such as this string: "C:\CurrentUserNam\RootFolder\ProjectFolderName\bin\Debug\MyProjFiles\YourFilesPathHere.EXT"
For great practical example of this, supposuply let's open our MSAccessDB.accdb which is already copied into our project folder \MyProjFiles\ by this code directly:
System.Diagnostics.Process.Start(My.Computer.FileSystem.CurrentDirectory() & "\MyProjFiles\MSAccessDB.accdb")
The result will be simply opening our database which called "MSAccessDB.accdb"
Or open some pdf files such as this line:
System.Diagnostics.Process.Start(My.Computer.FileSystem.CurrentDirector() & "\MyProjFiles\MyPdfFile.pdf")
and so on.
I hope this can help you all brothers.
Best ^_^ Regards.
You should read this link.
It explains how to read the information you need to give the access Datareader something to do.
.NET read binary contents of .lnk file
Maybe this is enough, so you don't need to copy anything.

Has anyone tried/had trouble with being able to build the Redbeard "Pages" tutorial project?

If I download the source and build it works fine, but if I do it myself Xcode won't find the default.inc.json file. If I alter the path to /default-theme/default.inc.json then that particular file is found, but other theme files aren't
Clearly, for some reason my set up is causing grief. However, analysing the directory structure of my app and the source comes up with no differences.
Has anyone run into the same?
Are you trying to set the 'root' theme file? If so it should be named 'theme.inc.json'. From there you should add in your own theme files and include files.
See this for further information about themes and the general structure. http://redbeard.io/documentation/theme-reference
I was having the exact same problem.
The problem was when one drags the 'default-theme' folder into the project.
A window will appear asking how you want to add the files: make sure "Copy items if needed" is checked, and "Create groups" is selected. Important: do not choose "Create folder references" otherwise your project will not work.
The example now works as documented.

Replacing the default File copy Dialog

i'm trying to replace the default file copy dialog with my own program, which I want to create with vb.net.
My problem:
Where can I enter my application path to start automatically (and parse arguments/paths) when the user copies and/or pastes files?
Thanks in advance!
In order to monitor a file path I would suggest using FileSystemWatcher Class. This will monitor a folder for any files that are copied and pasted to the location. There is a great example at the below link.
https://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher(v=vs.110).aspx

Add a image file in resources using VB code

I would like to know if there is any way to add a local file as resource using VB code. Its an image file . Normally I go to Project -> Project1 Properties -> Resources -> Add Resource -> Add Existing File -> and select my executable. I would like to do the above using Visual Basic code. Does anybody have any idea?
Last time I added a resource into my VB program I did the same as you have mentioned above, recently I went to do the same thing and found I had to search for the location and most replays to this question told you what to do but did not show the steps nor the screen which was kinda confusing. I hope the following helps.
Visual Studio 2017:
Right click in the solution explorer window on the VB project name name (Not where is says Solution 'Solution name' (1 project) the line just under that one. Select properties and you will see the project options screen open in front of you mine defaulted to the application tab shown on the left in the screen shot below.
Select the resources option on the left hand side of the screen, you now have options to add resource files to your executable, you can select the following types (Strings, images, icons, audio, files, other) . Note I read there is a size limit for individual files but it is possible to have multiple small files added.
Add your file. In the solution explorer a resources tab will now be visible with your file listed, in my example I added two sound files bite.wav and moan.wav (sorry not an image file). These sound files were compiled into my executable and I executed the sounds in the program with the following:
My.Computer.Audio.Play(My.Resources.Moan, AudioPlayMode.Background) 'Play audio file in background do not halt program
Your resource should now be able to be seen if you enter 'My.Resources.'

How do I publish a folder along with my VB.NET program that contains.html?

I have a VB.NET program that I wish to to publish. In the code it references a HTML page that I created. Instead of having the URL hard coded (example: www.test2.com/folder/index.html)
I would like to have it relative to wherever the encoder is installed to (example: /folder/index.html)
How can I do this?
Thanks!
In VB.Net you have either
Dim lPath As String = Application.ExecutablePath
Which gives you the full path and app.name (which you can remove) or
Dim lPath As String = Application.StartupPath
Which gives you the directory the application started up in ..
Not sure I know the answer to the clickonce question, as we use our own deployment method at work but if you :-
Add your file via Project Explorer
Right click on file, select properties and set Build Action to "content"
Go to Project, yourprojectnameProperties, then Publish tab, then
Application Files button
you should see the file listed there then set to Include(auto).
.... or copy and paste them using internet explorer into the project explorer
If the file is referenced within your solution, the publish operation should automatically include the file to be published.
as for reference, if the html is hosted with in same website, then you can use a relative path from the page you are linking to.
You can also reference the file in your code by using Server.MapPath("relativepathtofile") and the relative path to the file you're referencing.