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
Hamizah TALHAH
NA
15
890
Speed up retrieve image into picturebox
May 30 2017 10:13 PM
I'm currently working on windows form application which allow user to retrieve image after searching at textbox. The problem is the image is load very slow. How can I overcome this problem to speed up the loading? If anyone has suggestions for a faster way to retrieve these images, it would be greatly appreciated. Here is my code:
string
baseFolder = @
"\\\\jun01\\hr\\photo"
;
string
imgName =
"*"
+ textBoxEmplNo.Text +
"*.jpg"
;
//Bool to see if file is found after checking all
bool
fileFound =
false
;
DirectoryInfo di =
new
DirectoryInfo(baseFolder);
foreach
(var file
in
di.GetFiles(imgName, SearchOption.AllDirectories))
{
pictureBox1.Visible =
true
;
pictureBox1.Image = Image.FromFile(file.FullName);
fileFound =
true
;
break
;
}
if
(!fileFound)
{
pictureBox1.Visible =
true
;
pictureBox1.Image = Image.FromFile(@"\\\\jun01\\hr\\photo\\No-image-
found.jpg");
}
Reply
Answers (
3
)
Split table using VSTO
How to insert Blank page in current document.