vb.net - (VB) toggle labels on/off -
i have button when clicked labels show, code used when button clicked again hidden:
private sub form3_load(byval sender system.object, byval e system.eventargs) handles mybase.load label4.hide() label5.hide() label6.hide() end sub private sub button1_click(byval sender system.object, byval e system.eventargs) handles button1.click msgbox("all shortcuts require shift+(letter) combination", vbokonly, "shortcuts active") label4.show() label5.show() label6.show() end sub
simply check visible property
private sub button1_click(byval sender system.object, byval e system.eventargs) handles button1.click if label4.visible = false msgbox("all shortcuts require shift+(letter) combination", vbokonly, "shortcuts active") label4.show() label5.show() label6.show() else label4.hide() label5.hide() label6.hide() end if end sub
or more read , invert visible property
dim setvisible = not label4.visible if label4.visible = false msgbox("all shortcuts require shift+(letter) combination", vbokonly, "shortcuts active") end if label4.visible = setvisible label5.visible = setvisible label6.visible = setvisible end sub
Comments
Post a Comment