|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
mutil line txt boxHello
For a VB novice can anyone help me with the following simple idea. All I've got on my form is a Textbox, (mulitline = true) and a button. When I click the button I will have some simple lines of text to be displayed. How do I have... Dim addLine As String = "Next Line" Dim addLine As String = "Another Line" TextBox1.Text = "Line one" then the next line display Next Line and the next display Another Line What is the newline char? \n If I write this..
TextBox1.Text = "Line one"vbCrLf TextBox1.text "more Text" It just overwrites the top line, with the next line, then the next. I'm tring to display them on seperate line 1) Line one 2) more Text 3) something else Or am i doing this wrong? Show quoteHide quote "jvb" <gome***@gmail.com> wrote in message news:1139858036.243160.312900@o13g2000cwo.googlegroups.com... > vbCrLf > Try this...
Me.TextBox1.Text += "Line One" & vbCrLf Me.TextBox1.Text += "Line Two" & vbCrLf That will give you Line One Line Two Thanks, that works.
Show quoteHide quote "jvb" <gome***@gmail.com> wrote in message news:1139858889.407567.133070@g43g2000cwa.googlegroups.com... > Try this... > > Me.TextBox1.Text += "Line One" & vbCrLf > Me.TextBox1.Text += "Line Two" & vbCrLf > > That will give you > > Line One > Line Two > One more quick and easy question.
Me.TextBox1.Text += "Line Two" & vbCrLf How can I make that line BOLD? Thanks again Show quoteHide quote "jvb" <gome***@gmail.com> wrote in message news:1139860258.576021.153130@o13g2000cwo.googlegroups.com... > Your welcome! > You can't in a standard text box.
You'll need to use the rich text box ... different game altogether! _______________________________ The Grim Reaper Show quoteHide quote "Jason" <ja***@someone.com> wrote in message news:%239PsohNMGHA.532@TK2MSFTNGP15.phx.gbl... > One more quick and easy question. > Me.TextBox1.Text += "Line Two" & vbCrLf > > How can I make that line BOLD? > > Thanks again > > "jvb" <gome***@gmail.com> wrote in message > news:1139860258.576021.153130@o13g2000cwo.googlegroups.com... >> Your welcome! >> > > "jvb" <gome***@gmail.com> schrieb: Mhm... I suggest to use '&=' instead of '+=' to concatenate strings.> Me.TextBox1.Text += "Line One" & vbCrLf > Me.TextBox1.Text += "Line Two" & vbCrLf -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> Is there any reason that &= is better than +=? I have always used the
+. Am I going against convention? I was going to say "you're going against convention!".... but then I checked
my local MSDN and found; &= Concatenates a String expression to a String variable or property and assigns the result to the variable or property. += Adds the value of a numeric expression to the value of a numeric variable or property and assigns the result to the variable or property. Can also be used to concatenate a String expression to a String variable or property and assign the result to the variable or property. So there you go! ____________________________________ The Grim Reaper Show quoteHide quote "jvb" <gome***@gmail.com> wrote in message news:1139861138.148357.178990@f14g2000cwb.googlegroups.com... > Is there any reason that &= is better than +=? I have always used the > +. Am I going against convention? > "The Grim Reaper" <grim_rea***@REMOVEbtopenworld.com> schrieb: Mhm... But I remember the documentation for '&' recommends to use '&' for >I was going to say "you're going against convention!".... but then I >checked my local MSDN and found; > > &= > Concatenates a String expression to a String variable or property and > assigns the result to the variable or property. > > += > Adds the value of a numeric expression to the value of a numeric variable > or property and assigns the result to the variable or property. Can also > be used to concatenate a String expression to a String variable or > property and assign the result to the variable or property. string concatenation instead of '+'. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message They do. Because it removes uncertainty of the result when Option Strict is > Mhm... But I remember the documentation for '&' recommends to use '&' for > string concatenation instead of '+'. OFF. When Option Strict is ON there's no reason to choose one over the other. At that point, it comes down to subjectivity or company standards.... I stopped using & in my move to .NET. But, I miss &.... and standardizing on + (for me) has caused problems once in a while.... like when I load up someone else's code module and it has Option Strict OFF in it and I don't realize it. :-( Hi,
Try this one with option strict off and be happy dim a as string = "1" a += 1 Cor Show quoteHide quote "The Grim Reaper" <grim_rea***@REMOVEbtopenworld.com> schreef in bericht news:dsqpcf$nk9$1@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com... >I was going to say "you're going against convention!".... but then I >checked my local MSDN and found; > > &= > Concatenates a String expression to a String variable or property and > assigns the result to the variable or property. > > += > Adds the value of a numeric expression to the value of a numeric variable > or property and assigns the result to the variable or property. Can also > be used to concatenate a String expression to a String variable or > property and assign the result to the variable or property. > > So there you go! > ____________________________________ > The Grim Reaper > > "jvb" <gome***@gmail.com> wrote in message > news:1139861138.148357.178990@f14g2000cwb.googlegroups.com... >> Is there any reason that &= is better than +=? I have always used the >> +. Am I going against convention? >> > >
Show quote
Hide quote
"Jason" <ja***@someone.com> schrieb: \\\> All I've got on my form is a Textbox, (mulitline = true) and a button. > > When I click the button I will have some simple lines of text to be > displayed. How do I have... > > Dim addLine As String = "Next Line" > Dim addLine As String = "Another Line" > > > TextBox1.Text = "Line one" > then the next line display Next Line > and the next display Another Line Me.TextBox1.Text = _ "Line 1" & ControlChars.NewLine & _ "Line 2" & ControlChars.NewLine & _ "Line 3" /// -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> Anyone...
when I run this Me.TextBox1.Text += "Line One" & vbCrLf Me.TextBox1.Text += "Line Two" & vbCrLf I get... Line One Line Two But both lines are selected, is that supposed to be that way? How can I get rid of the highlighting? Show quoteHide quote "Jason" <ja***@someone.com> wrote in message news:OPd89ANMGHA.3144@TK2MSFTNGP11.phx.gbl... > Hello > > For a VB novice can anyone help me with the following simple idea. > > All I've got on my form is a Textbox, (mulitline = true) and a button. > > When I click the button I will have some simple lines of text to be > displayed. How do I have... > > Dim addLine As String = "Next Line" > Dim addLine As String = "Another Line" > > > TextBox1.Text = "Line one" > then the next line display Next Line > and the next display Another Line > > What is the newline char? \n > > Me.TextBox1.SelectionStart = 0
Me.TextBox1.SelectionLength = 0 (I haven't had cause to use them much before, so experiment with what you want to achieve) ___________________________________ The Grim Reaper Show quoteHide quote "Jason" <ja***@someone.com> wrote in message news:u$7yRoNMGHA.648@TK2MSFTNGP14.phx.gbl... > Anyone... > > when I run this > Me.TextBox1.Text += "Line One" & vbCrLf > Me.TextBox1.Text += "Line Two" & vbCrLf > > I get... > > Line One > Line Two > > But both lines are selected, is that supposed to be that way? How can I > get rid of the highlighting? > > "Jason" <ja***@someone.com> wrote in message > news:OPd89ANMGHA.3144@TK2MSFTNGP11.phx.gbl... >> Hello >> >> For a VB novice can anyone help me with the following simple idea. >> >> All I've got on my form is a Textbox, (mulitline = true) and a button. >> >> When I click the button I will have some simple lines of text to be >> displayed. How do I have... >> >> Dim addLine As String = "Next Line" >> Dim addLine As String = "Another Line" >> >> >> TextBox1.Text = "Line one" >> then the next line display Next Line >> and the next display Another Line >> >> What is the newline char? \n >> >> > > Thanks
Shouldn't that be in the properties of the Text Box? Also how do you make a one line of text bold? Me.TextBox1.Text += "Line One" & vbCrLf Me.TextBox1.Text += "Line Two" & vbCrLf Show quoteHide quote "The Grim Reaper" <grim_rea***@REMOVEbtopenworld.com> wrote in message news:dsqpkn$g10$1@nwrdmz01.dmz.ncs.ea.ibs-infra.bt.com... > Me.TextBox1.SelectionStart = 0 > Me.TextBox1.SelectionLength = 0 > > (I haven't had cause to use them much before, so experiment with what you > want to achieve) > ___________________________________ > The Grim Reaper > > "Jason" <ja***@someone.com> wrote in message > news:u$7yRoNMGHA.648@TK2MSFTNGP14.phx.gbl... >> Anyone... >> >> when I run this >> Me.TextBox1.Text += "Line One" & vbCrLf >> Me.TextBox1.Text += "Line Two" & vbCrLf >> >> I get... >> >> Line One >> Line Two >> >> But both lines are selected, is that supposed to be that way? How can I >> get rid of the highlighting? >> >> "Jason" <ja***@someone.com> wrote in message >> news:OPd89ANMGHA.3144@TK2MSFTNGP11.phx.gbl... >>> Hello >>> >>> For a VB novice can anyone help me with the following simple idea. >>> >>> All I've got on my form is a Textbox, (mulitline = true) and a button. >>> >>> When I click the button I will have some simple lines of text to be >>> displayed. How do I have... >>> >>> Dim addLine As String = "Next Line" >>> Dim addLine As String = "Another Line" >>> >>> >>> TextBox1.Text = "Line one" >>> then the next line display Next Line >>> and the next display Another Line >>> >>> What is the newline char? \n >>> >>> >> >> > > To have only one line bold, you have to use a RichTextBox. Select the
text you want and execute this line: rtb.SelectionFont = New Font(rtb.Font, FontStyle.Bold) where rtb is the RichTextBox. If I've got this
Me.RichTextBox1.Text = "In Rich Text Box" Me.RichTextBox1.Text &= "Line two" & vbCrLf How do I make the second line BOLD? Show quoteHide quote "jvb" <gome***@gmail.com> wrote in message news:1139864547.410442.110080@z14g2000cwz.googlegroups.com... > To have only one line bold, you have to use a RichTextBox. Select the > text you want and execute this line: > > rtb.SelectionFont = New Font(rtb.Font, FontStyle.Bold) > > where rtb is the RichTextBox. >
filesystem.getfiles question
BackGroundWorker.ProgressChanged "Cross-thread operation not valid" at 2nd/3th/... progress sleep? VS2005 Buiild Options compiles as a form -- but not as a control Start Process Troubles Closing a Form Convert RTF Text to Plain Text sleep or delay add columns (modify) Datatable AND source MDB |
|||||||||||||||||||||||