Type String Out In TextBox (VB.NET) -



Type String Out In TextBox (VB.NET) -

i trying create application create if string beingness typed out textbox. main problem code seems thread.sleep not sleep each individual character, whole application. example, if phone call sub string "hello", stop 100 milliseconds, , textbox display "hello" @ once.

sub typeout(byval totype string) totype = totype.tochararray() each letter char in totype textbox2.text = textbox2.text + letter threading.thread.sleep(100) next end sub

thanks help!

this ideal job timer. can create can have more 1 textbox beingness typed @ same time @ different speeds.

demonstration of concept: placed 2 textboxes , 2 buttons on new windows forms project form , used next code accomplish that:

public class form1 private class typetext property target textbox property texttotype string private tim system.windows.forms.timer private currentchar integer private sub emitcharacters(sender object, e eventargs) target.text &= texttotype.chars(currentchar) currentchar += 1 if currentchar = texttotype.length removehandler tim.tick, addressof emitcharacters tim.dipose() end if end sub public sub start() addhandler tim.tick, addressof emitcharacters tim.start() end sub 'todo: add together stop, pause, restart etc. methods if needed public sub new(target textbox, texttotype string, interval integer) me.target = target me.texttotype = texttotype tim = new system.windows.forms.timer tim.interval = interval currentchar = 0 end sub end class private sub button1_click(sender object, e eventargs) handles button1.click dim typer new typetext(textbox1, "hello, world!", 200) typer.start() end sub private sub button2_click(sender object, e eventargs) handles button2.click dim typer new typetext(textbox2, "this other text.", 350) typer.start() end sub end class

vb.net string

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -