vb.net - Issue with Application.DoEvents() -


i have used application.doevents() in code can exit loop button press, having issue have click on screen before can press exit button, needing 2 clicks. happens every time play try stop program, without closing it. how fix this?

do while stopprogram = false     application.doevents()     radianangle = angle * placeholder     me.refresh()     if directionpositive = false         angle += 1         if angle = 51             angle = 49             directionpositive = true         end if     elseif directionpositive = true         angle -= 1         if angle = -51             angle = -49             directionpositive = false         end if     end if loop 

private sub button2_click(sender system.object, e system.eventargs) handles button2.click     stopprogram = false     runningprogram() end sub 

private sub button3_click(sender system.object, e system.eventargs) handles button3.click     stopprogram = true end sub 

one workaround: work ok if use mousedown instead of click events.


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -