visual studio 2010 - Windows Forms problem in VB.NET -
i'm making simple game application. main form (form1) has single button on labeled button1. (very creative naming, eh?) point of application move button in random directions across form. problem when start debugging (i'm using visual studio 2010) form never shows up, , when open windows task manager name of .exe never shows in process list. wondering if code i'm using have that. here's code:
class form1 private sub form1_load(...) initializecomponent() while true moveit() end while end sub sub moveit() dim rand short randomize() rand = (rnd() * 5) select case rand case 0 'move button 5px button1.top -= 5 case 1 'move button 5px button1.top -= 5 case 2 'move button left 5px button1.left -= 5 case 3 'move button right 5px button1.left += 5 case 4 'move button down 5px button1.top += 5 case 5 'move button down 5px button1.top += 5 end select end sub end class
yes, code has this. have endless while
loop in form's load
event, means load
event never returns, means form never finishes loading.
instead of calling load
event, trigger start of random-button-movement process using begininvoke
load
event:
Comments
Post a Comment