TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ianparkins
NA
5
0
Picture in PictureBox Control
Nov 20 2004 7:28 PM
Hi all, I just have a Windows Form with a PictureBox which I named ("picVehicle"), an OpenFileDialog Control named ("ofdPicture"), and a Button named ("btnOpen") - with the following code in its click event. However, for some strange reason, when I run my program->click my open button->and choose the file I want as the picture to display, nothing appears in the picture box. No exceptions/errors are thrown when compiled or ran. Here is my code. If anyone could test this code and see if it works for them that would be great. I can't figure out what is going wrong. Any help would be greatly appreciated. Thanks, Zach (Nevermore) ___________________________Code_________________________________________ private void btnOpen_Click(object sender, System.EventArgs e) { string strImageName = ""; Stream fileStream; try { ofdPicture.Filter = "JPEG Images (*.jpg,*.jpeg)|*.jpg;*.jpeg|Gif Images (*.gif|*.gif|Bitmaps (*.bmp)|*.bmp"; ofdPicture.FilterIndex=1; if (ofdPicture.ShowDialog()==DialogResult.OK) { if((fileStream=ofdPicture.OpenFile())!=null) { strImageName=ofdPicture.FileName; fileStream.Close(); picVehicle.Image=Image.FromFile(strImageName); } } } catch(Exception ex) { Console.WriteLine(ex.ToString()); } }
Reply
Answers (
1
)
Associating a query with Crystal Reports and setting params at runtime
Beginning VB.Net Question