Hi all. I have a silly app, and I just want to change the picture in a picturebox with a click event. I'm attaching the screen shot, but there are really only important details (I mean, I haven't done more than three things!).
(1) I have a folder of optimized images entitles "Images". I dragged them to the the title of my project, which is "PhotoFrame", and now under the main PhotoFrame heading (and below the references section), there it is Images. When it is expanded, I should have access to (say) image_10.jpg.
(2) I created a button, and
(3) Upon click of the button, I execute:
pictureBox1.Image = Image.FromFile("Images\Image_10.jpg");
*(4) Horrible crash!! I've tried all variations on the path name, nothing works. I'm not a c# guy (vb.net a little), but this is just beyond me since the folder has been added. I'll attach the exception text below and a screen shot--again, I know this will be a picnic for you guys, I'm still getting the ropes.
Thanks.
Exception:
This exception was originally thrown at this call stack:
System.Drawing.Image.FromFile(string, bool)
System.Drawing.Image.FromFile(string)
PhotoFrame.Form1.button1_Click(object, System.EventArgs) in Form1.cs
System.Windows.Forms.Control.OnClick(System.EventArgs)
System.Windows.Forms.Button.OnClick(System.EventArgs)
System.Windows.Forms.Button.OnMouseUp(System.Windows.Forms.MouseEventArgs)
System.Windows.Forms.Control.WmMouseUp(ref System.Windows.Forms.Message, System.Windows.Forms.MouseButtons, int)
System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message)
System.Windows.Forms.ButtonBase.WndProc(ref System.Windows.Forms.Message)
System.Windows.Forms.Button.WndProc(ref System.Windows.Forms.Message)
...
[Call Stack Truncated]
(1) I have a folder of optimized images entitles "Images". I dragged them to the the title of my project, which is "PhotoFrame", and now under the main PhotoFrame heading (and below the references section), there it is Images. When it is expanded, I should have access to (say) image_10.jpg.
(2) I created a button, and
(3) Upon click of the button, I execute:
pictureBox1.Image = Image.FromFile("Images\Image_10.jpg");
*(4) Horrible crash!! I've tried all variations on the path name, nothing works. I'm not a c# guy (vb.net a little), but this is just beyond me since the folder has been added. I'll attach the exception text below and a screen shot--again, I know this will be a picnic for you guys, I'm still getting the ropes.
Thanks.
Exception:
This exception was originally thrown at this call stack:
System.Drawing.Image.FromFile(string, bool)
System.Drawing.Image.FromFile(string)
PhotoFrame.Form1.button1_Click(object, System.EventArgs) in Form1.cs
System.Windows.Forms.Control.OnClick(System.EventArgs)
System.Windows.Forms.Button.OnClick(System.EventArgs)
System.Windows.Forms.Button.OnMouseUp(System.Windows.Forms.MouseEventArgs)
System.Windows.Forms.Control.WmMouseUp(ref System.Windows.Forms.Message, System.Windows.Forms.MouseButtons, int)
System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message)
System.Windows.Forms.ButtonBase.WndProc(ref System.Windows.Forms.Message)
System.Windows.Forms.Button.WndProc(ref System.Windows.Forms.Message)
...
[Call Stack Truncated]