vb.net - How can i shorten this code? -
private sub timer1_tick(sender object, e eventargs) handles timer1.tick if label1.text.length = 13 label1.text = "working magic." elseif label1.text.length = 14 label1.text = "working magic.." elseif label1.text.length = 15 label1.text = "working magic..." elseif label1.text.length = 16 label1.text = "working magic" end if end sub the code acting progressive string, every 500 milliseconds dot add string, until 3 dots resets.
if wanted more dots nice automate process, instead of writing infinite number of lines of code.
if want shorten code this:
private sub timer1_tick(sender object, e eventargs) handles timer1.tick (label1.text += ".").replace("....","") end sub however i'm convinced shorter not better!
edit: sorry mind goes straight c#, here vb::
private sub timer1_tick(sender object, e eventargs) handles timer1.tick label1.text = (label1.text + ".").replace("....","") end sub
Comments
Post a Comment