Very quick question, hopefully !!!
If I want to add a picture to my VS2010 C# project, either as a background, for use as an icon, whatever, can I just insert it and when I save the project it will be automatically stored within the project directories somewhere, or should I copy the file to a specific folder within my project before accessing and using it ?!?
I am worried that when I pass this project on to the end user(s) it will include links to files on my PC which they will not have access to ...
Thanks in advance,
Gaz
Loading
Gary HeathPosted Jan 20, 2012, 6:43 PM
Thanks for your reply & support ... I'm sure you'll hear from me again !!!
Sam HobbsPosted Jan 20, 2012, 6:21 PM
The first language I learned was Fortran using an IBM 1620; I was in High School. Most of my earlier professional experience was also with COBOL, using 360 and 370 mainframes. I assume you also have used IBM (Hollerith) Cards.
For COBOL programmers, fixed-length records are normal. One thing that might be frustrating is if you try to explain to a C++ or C# programmer that fixed-length records can be useful, they will not understand. So yes there will be some adjustment.
I don't know how much online COBOL programming you have done, such as IMS and CICS. One of the reasons GUI programs are more complicated is that a UI needs to be event-driven and that can make things more complicated. So if you want a COBOL-style batch program, you can use a Windows Console program and I assume you know that.
So to get back to your original question, it is relatively easy to make a mistake and send a Word or HTML document with linked files without realizing that the files are not included. I think it is less likely to make that mistake with a C# program but there are so many ways to do it that it certainly is possible to make a mistake.
Gary HeathPosted Jan 20, 2012, 5:08 PM
For starters, this program (Project) is for one person (not me, hence my concern about linking to something on my PC) to do something simple on a small database ... I'm a Mainframe (COBOL) programmer by trade and I am having such a hard time getting my 53 year old head around the terminology (much more so than the logic) of .net & C# ... I *need* to get code down, I *need* to see results ... I'll re-write and improve when and as I learn, but sometimes the simplest things seem so complicated !!!
Sorry for that little rant ... good to get it off my chest though !!!
Sam HobbsPosted Jan 20, 2012, 3:58 PM
Gary HeathPosted Jan 20, 2012, 8:13 AM
I think I have sussed it out now anyway, I found this on the web ...
"The PictureBox control is blank when you first add one. To add an image to it at Design Time, have a look at the Properties Window. Locate the Image property. Click the button with the three dots on it to see a dialogue box appear. Click the Import button at the bottom and you'll see a standard Open dialogue box. Search your hard drive for a suitable image. Because you have "Project resource file" selected, C# will copy the image to a folder in your project. (This is handy if you want to send your programme to anyone else.)"
This is essentially what I wanted to know, "would VS2010 automatically copy & store that image into the Project or did I have to copy that image into the Project before I used it", it seems it is the first option, but thank you all for your help and suggestions ...
Posted Jan 20, 2012, 7:47 AM
For windows application.
Image image = Image.FromFile("imagename.png"); pictureBox1.Image = image; pictureBox1.Height = image.Height; pictureBox1.Width = image.Width;
runat="server" AlternateText="Image text" ImageAlign="left" ImageUrl="images/image1.jpg"/>For web application.
Gary HeathPosted Jan 20, 2012, 7:26 AM
Jignesh TrivediPosted Jan 20, 2012, 7:18 AM
image and icon, you can add as embadded resource as well as with in project.
if you use image from project, not use hard code path but relative path.
example : imageurl = "~\Images\me.gif". this means that when our project is looking in project folder in window base application exe path and for web application root folder of application.
hope this help.