.net - Why am I getting an extraneous carriage return in a multi-line text box? -
i have strange bug occurring in winforms application, multi-line textbox. when change text of textbox, getting line break. positioning of line break varies. example, if this:
sometextbox.clear() sometextbox.text = someotherobject.sometextproperty then line break @ end of text. however, if don't call clear first, using same value sometextproperty, line break @ beginning. however, if use test string "test", line break @ beginning of text, whether or not call clear() first. , if use appendtext(), line break inserted @ end in cases.
can explain these extraneous line breaks/carriage returns coming from, , why positioning changes?
use .lines() property instead of .text. (see documentation here.)
you not need use .clear; instead, make sure array passing not contain unwanted empty strings, these translate empty lines.
some example code:
'set lines dim mylines string() = {"hello.", _ "my name inigo montoya.", _ "", _ "you killed father.", _ "prepare die."} sometextbox.lines = mylines 'get lines msgbox(join(sometextbox.lines, vbcrlf)) i have tested above successfully. if you're still having problems, post code set value (using someotherobject.sometextproperty) or read values, because problem there.
Comments
Post a Comment