469,923 Members | 1,570 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,923 developers. It's quick & easy.

problem in picture displaying

i display a pic on picture box and then i want to display another pic after some seconds
but problem is that first image is not displaying only display 2nd image

1... display first picture from database such as
pbThumbImage.Image = new Bitmap(new MemoryStream(objEmployee.Picture));

2... and then get the reference of current main thread
Thread main = Thread.CurrentThread;
Thread.Sleep(5000);

3.. and then display another pic
pbThumbImage.Image = global::TimeEntrySystem.Properties.Resources.Defau ltImage;

but problem is that first image is not displaying only display 2nd image
Aug 11 '08 #1
4 1386
Hey buddy

Try this

Expand|Select|Wrap|Line Numbers
  1. pbThumbImage.Image = new Bitmap(new MemoryStream(objEmployee.Picture));
  2. Application.DoEvents();
  3. Thread.Sleep(5000);
  4. pbThumbImage.Image = global::TimeEntrySystem.Properties.Resources.DefaultImage;
Hope that helps

i display a pic on picture box and then i want to display another pic after some seconds
but problem is that first image is not displaying only display 2nd image

1... display first picture from database such as
pbThumbImage.Image = new Bitmap(new MemoryStream(objEmployee.Picture));

2... and then get the reference of current main thread
Thread main = Thread.CurrentThread;
Thread.Sleep(5000);

3.. and then display another pic
pbThumbImage.Image = global::TimeEntrySystem.Properties.Resources.Defau ltImage;

but problem is that first image is not displaying only display 2nd image
Aug 11 '08 #2
thanks to answer my question
buddy problem is solved

but there is an other problem when 1st pic is display , also a string is also display which blink through timer event but now this string not blink
Aug 11 '08 #3
Can you post the piece of code here

thanks to answer my question
buddy problem is solved

but there is an other problem when 1st pic is display , also a string is also display which blink through timer event but now this string not blink
Aug 11 '08 #4
tlhintoq
3,525 Expert 2GB
I suspect the source of your problem is that you are putting the tread to sleep. When its asleep its not doing anything, including painting your dialog, updating your string etc. Its not a counter or wait function.

Many ways around it but here's one suggestion:
A timer with a 1000 interval (milliseconds therefore this is 1 second interval)
Set a counter to however many seconds you want to wait.
Decrement it and update your status string on each tick.
When your counter hits zero... Do something such as change the image.
Aug 12 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by Nutshell | last post: by
1 post views Thread by Rob Parker | last post: by
1 post views Thread by Rob Parker | last post: by
2 posts views Thread by Lyn | last post: by
3 posts views Thread by velu | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.