Thank you very much for replying to my communique as promptly as you did. Please accept my apologies for not responding equally as quickly, but I was away from home over the weekend.
In fact, I have actually found the solution to my issue, but I'd like to elaborate a little on my scenario.
I'm using Microsoft Visual Studio Express 2013 for Web, in conjuction with your book, Beginning ASP.NET 4 in C# and VB
, to try and teach myself something about web design. To this end, my web site contains 3 or 4 pages of narrative, 1 page of small images(12), and another page kept on for experimental purposes.
The images page is the one I was having problems with. You're correct of course in suggesting there aren't any 'Picture Boxes', as used in Visual Basic(VB
), but there are 3 similar objects available which go by the names of Image, ImageButton, and ImageMap. Please forgive me if this sounds a bit like 'Teaching your Grandmother to suck eggs'. I've not looked too closely at the 3rd one, ImageMap, but the other two each contain properties such as ID, Width and Height, and one called ImageUrl. This ImageUrl is the property that contains the reference to the desired image file.
This property can be given a default or initial reference, but it only takes one line of VB
code to change that reference to point to another image file: ImageButton1.ImageUrl = MyImageUrl.
ImageButton1 is the ID property value(the name given to the object), and ImageUrl is another of the properties.
MyImageUrl is a string variable which contains the Path to, and the Name of, the image file.
Where I was going wrong is that at the point of execution of this instruction, MyImageUrl contained the full path to the file name, eg. D:\This\That\And\The\Next\Thing\<WebSiteLocationOn Server(WWW)>\On\Down\To\<MyFileName>. I required all this because I needed to carry out a File.Exists(<FileName>) function before I would try to do anything further with such a file.
However, the ImageUrl property doesn't want all that, it only wants that bit of the path that follows on from the WWW level of the path, everything preceeding that, including the WWW bit being replaced by the 'Epsilon' (at least I think that's what it's called) character '~', which, now that I'm beginning to appreciate the web environment, makes sense. So the string value at time of execution would be: ~\On\Down\To\<MyFileName>.
In doing this, I resolved my problem.
My next requirement regarding these image placeholders is to figure out how to get the image sized properly within the placeholders, such that it doesn't get stretched, squashed, or whatever else makes it not look right. In VB
, you used a 'SizeMode' property set to Zoom, but I haven't found the appropriate replacement for that yet in this working environment. However, I notice in your book that you include something about creating properties for objects, which may be where I'll find a solution, but I haven't explored that in any great detail yet.
Once again, please forgive me Imar, if I sound as if I'm trying to tell you something you don't know already, but perhaps someone else reading this may appreciate my explanation.
Thank you once again, and may I wish you good fortune with this and any other publications you put forward.