Add a image file in resources using VB code - vb.net

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.'

Related

Excel on Mac. Cannot open IQY file in Data/Get External Data/Run Web Query

I am running Excel version 16.45 on Mac.
I have created a .iqy and saved it in the Queries directory alongside certain templates which were already there.
I go to Data/Get External Data/Run Web Queries. While the templates are accessible, my file is visible but greyed out (same thing happens if I save the file in a different directory).
Would anyone be able to help?
According to your information, I would like to confirm whether the issue occurs when you follow the steps as below:
1.Create a Word file, paste the web URL.
2.Save the Word as .iqy with .txt format.
3.Choose MS-DOS as coding.
4.Create an Excel file and click "Data >Get External Data >Run Web Query (Or Run Saved Query) " of the Bar
I was able to address the issue as follows.
When navigating to the relevant directory with Finder, the '.iqy' file appears to be appropriately named (as per Image 1).
In fact, if you reach the file in Terminal, the file is saved as '.iqy.txt'.
So all I had to do is rename the file, simply removing the '.txt' string at the end.
Screen you see when navigating in Finder

Adding an image to a solution which won't compile and which can be navigated to

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")

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.

Icon specified in info.plist not found under the top level app wrapper

I'm trying to upload my binary to iTunes Connect using Applicaton Loader. When I select the file and hit send, it sends for about a second and then this error pops up,
Icon specified in the info.plist not found under the top level app wrapper: Default -Landscape#2x~ipad.png
What does this mean? How do I fix it?
Another setting that can cause the issue:
You have to make sure the icon files are also found under build phases/bundle resources
Edit your projects .plist file "as source code" i.e. open it in any old text editor. Then manually edit the icon file names until they make sense.
The .plist is case-sensitive when validated and archived for upload to the App Store.
If you have this in the .plist:
icon-72#2X.png
the file name can not be
icon-72#2x.png
owing to the the case change of the x character .
I rename the file and corresponding change the name of icon file in the info.plist and this solution works for me.
Clean your build
Make sure the file is actually on the file system
Make sure you can see the file in the project navigator.
Most likely step 3 will fail. If so, drag the icon from the finder onto the Project Navigator. When asked, uncheck the "copy ..blabla" option because since the file is already there where you are dragging it to, it would fail. Once the file shows up in the Project Navigator you should be golden.
Also check that you dont have 2 icons with the same name anywhere in your project folders.
I am thinking that the answer to this question will vary in time because Apple constantly changes the application validation rules. These validation rules will surface only when you are submitting your app to the AppStore.
In this particular situation, the validation error happened to me while uploading the app on 08/03/2012.
The solution was fairly straight forward. I had to move to icon files which I had located in a folder nested within the project directory all to way up to the TOP LEVEL project directory - one that has the project file in it. Once I did that and readded the files back to the Resources in my project the validation error went away.
Of course you should check that this issue is not caused by misspelled filenames i.e. differences between your plist file and true names of icon files on your file system.
Another little issue that caught me out was an empty string. I got the cryptic failure message ...
Icon specified in the info.plist not found under the top level app wrapper:
And found this lurking in my plist
<string></string>
I was similar problem's. I have resolve to do this
1/ delete your application Icone in your Target
2/ rename your icone ex: applicationNameSmall.png
3/ add your icone in your application.
This, works for me.
Error is coming up because the App Store is checking names of icon files based upon yourProject-info.plist. If they don't match, error message.
To resolve this issue: Go to yourProject-info.plist in xcode and check BOTH "icon-files" and "icon-files(IOS5)" arrays. You'll want to make sure that each string corresponds with the icon files you have in the file directory.
Change or delete mismatched string names (I had to delete a blank string). Rebuild. As other posters have noted, names are case-sensitive, so be mindful of that too.
Sometimes Icon.png files needs to be open in some image editing tool (e.g Adob Photoshop) and save as a new image. This works fine. Check attached images some times image properties don't change by renaming image file manually.
I had the same issue. I just added the image files it complained about to the project in the viewer. Not sure if that was the right thing to do, but it resolved the issue for me.
I had a silly mistake, in my info.plist the i had Icon.png, and the real file name was icon.png (no uppercase)
Fix the images issues it suggests.
Clean your project.
Build and run to make sure nothing has broken.
Delete the previous archive
Make a new archive (Product -> Archive)
This worked for me. I had to rearchive my application cause the previous one was not updated.
I had the same problem. I gone to Targets->Build Phases and deleted from there old (test) icons which I had pushed early. Good luck:)

Cannot create localizable strings files copies in XCode4

I have a "Resources/en.lproj/Localized.strings" file, with some key/value pairs in the format:
"key"="value";
I select this file and in File Inspector in the Utilities Pane I choose to add a new localization (es) pressing the '+' button in the Localization tab.
This action should create a new file "Resources/es.lproj/Localized.strings", but instead the original "Resources/en.lproj/Localized.strings" now displays a small triangle at the left ( as if it were a folder ) and holds inside two files Localized.strings (English) and Localized.strings (Spanish). No es.lproj directory created.
I have never read of this behavior even in references to this using XCode4.
What I'm missing?
Updated info:
I have checked the app bundle installed in my iPhone Simulator and the folders are created there, with the corresponding files.
I don't know if this is the default way but is confusing to me since reading the documentation this is not what I understand.
Your could try this : Quit XCode, relaunch your project. Remove all localizations from your project properties (keeping the files when asked), add them back, remove es localization on your file, then add it back.