vb.net - Replace certain word in textbox with vb and retrieve whole string after -


i'm looking make application replaces users selected word underscores, issue here fact well, however, not return entire string rather underscores themselves.

tbtext.text = replace(tbtext.text, tbtext.selectedtext,       generateunderscores(tbtext.selectedtext), tbtext.selectionstart, 1) 

generateunderscores function created returns underscores depending on number of letters in selectedtext

tbtext textbox, when user highlights want function run. replace selected text underscores.

notice how make tbtext.text contain this, becomes underscores without remainder of text in textbox.

how can return text in text-box as-well underscores in it? i've tried using string replace however, issue found multiple words instead of 1 word wanted removed (selected word)

thanks.

when user highlights want function run dont know how part, because there no textselected or selectedtextchanged event. used right mouse down. try use left mouse up, means text changed if user wants made mistake or wants change whats selected.

private sub textbox1_mousedown(sender object, e mouseeventargs)                    handles textbox1.mousedown     if e.button = windows.forms.mousebuttons.right andalso                 textbox1.selectedtext.length > 0          textbox1.selectedtext = makeunderscores(textbox1.selectedtext.length)      end if end sub  function makeunderscores(n integer) string     return new string("_"c, n) end function 

i not sure vb's replace function wouldn't same string.replace


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

django - CSRF verification failed. Request aborted. CSRF cookie not set -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -