I have kept the code in a timer_tick event
Time is set for 500ms.
for the first tiem of the timer tick event, both the statements in the true part is executing, but , for the second time and all only the second statement i.e iFlag=2 is only executing.,a nd MessageBox.Show is skipped.
Even if i have any statement in that place, only the second statement is executed.
Can anybody please help me out.
I am mad to see this work like this.
Sometimes,
if i keep only 1 statement in the true and the else part, both the statements are executed.
It is not showing me any errors, if there are some braces problem.
please can anybody help me.
Looking at your code the else part should never be executed, so your code really doesn't make sense to me. Have you tried setting a breakpoint and running the debugger?
The Web Standards Project – Build accessible standard compliant websites, please! Browse Happy – Don't forget to support the browsers with standard compliance
if ((String.Compare(PictureBox1.BorderStyle.ToString(),"Fixed3D"))==0)
{ PictureBox1.Image=Image.FromFile("C:\\Anim\\Animation4.gif"); PictureBox1.BorderStyle=BorderStyle.None;
}
This is the acutal code,
Initially while loading the form ,i am setting the borderstyle of the picturebox to fixed3d.
And this code placed in a timer tick event,
checks the borderstyle and changes it only if it is a fixed3d.
For the first timee tick,
both the statements in the if loop is executed.
But when it comes for the second time,
only the second statment is executed and not the first.
Even if i change the order of the statements as,
I'll ask again, have you tried setting a breakpoint and running the debugger to see if that tells you anything?
The Web Standards Project – Build accessible standard compliant websites, please! Browse Happy – Don't forget to support the browsers with standard compliance
Hmm.... it looks like it runs the same time unnoticingly for you
if you can see, if you compare the first time if its fixed3D , then it will change the border and the image. then the second time its runs, isince the first time is the image and border, so why would it want change the image since it has already hanged in the first place?
just a suggestion, you might want to change to another image first b4 it changes back.
Bookmarks