.net 2.0 - How to write a common code to display many picturebox in vb.net 2.0 ? -
imports system.threading.thread public class form1 dim delay integer = 200 dim integer = 1 private sub button1_click(sender object, e eventargs) handles button1.click while <= 5 picturebox1.visible = true picturebox1.refresh() sleep(delay) picturebox1.visible = false picturebox2.visible = true picturebox2.refresh() sleep(delay) picturebox2.visible = false picturebox3.visible = true picturebox3.refresh() sleep(delay) picturebox3.visible = false picturebox4.visible = true picturebox4.refresh() sleep(delay) picturebox4.visible = false picturebox5.visible = true picturebox5.refresh() sleep(delay) picturebox5.visible = false = + 1 if = 6 = 1 end if end while end sub
i wrote above code. it's working. following code not not working. want minimize code. want use 20 picture box. instead of above code want use small code same work. please me.
private sub button2_click(sender object, e eventargs) handles button2.click while <= 5 dim pic picturebox dim matches() control matches = me.controls.find("picturebox" & i.tostring(), true) if matches.length > 0 andalso typeof matches(0) label pic = directcast(matches(0), picturebox) pic.visible = true pic.refresh() sleep(delay) pic.visible = false end if = + 1 if = 6 = 1 end if end while end sub end class
private sub button2_click(sender object, e eventargs) handles button2.click while <= 5 dim pic picturebox dim matches() control matches = me.controls.find("picturebox" & i.tostring(), true) if matches.length > 0 andalso typeof matches(0) picturebox pic = directcast(matches(0), picturebox) pic.visible = true pic.refresh() wait(delay) pic.visible = false end if = + 1 if = 6 = 1 end if end while end sub
this code correct... sorry wrote wrong code 1st time.. it's correct.. thank u all..
Comments
Post a Comment