|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How Do I Put An End Of Line Character In A TextBoxHow would I put an end of line character in the second line below?
Textbox1.Text = "Hello " Textbox1.Text = Textbox1.Text = "World" Thanks, Chris Lusardi I didn't know vbcrlf existed. At the top of some of my programs I have
dim crlf as string = Chr(13) & Chr(10) guess I don't need that but now I have to type vbcrlf instead of crlf. Ahmed wrote: Show quoteHide quote > textbox1.text "Hello " & vbcrlf & vbcrlf & "World" > "cj" <cj@nospam.nospam> schrieb: No, you don't need it. Note that VB.NET has a 'ControlChars.NewLine' >I didn't know vbcrlf existed. At the top of some of my programs I have > dim crlf as string = Chr(13) & Chr(10) > guess I don't need that but now I have to type vbcrlf instead of crlf. constant too, and 'Environment.NewLine' will return the system's new line character. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> Herfried,
I once asked you to make a testset and you told than that you had not the time to type that. Why are you advicing that long code, while there is that simple vbcrlf. In C# I find the 'ControlChars.NewLine' a very good alternative for the literal. But VB has a better solution for that. Cor Show quoteHide quote "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> schreef in bericht news:OBLK0UTeGHA.4040@TK2MSFTNGP05.phx.gbl... > "cj" <cj@nospam.nospam> schrieb: >>I didn't know vbcrlf existed. At the top of some of my programs I have >> dim crlf as string = Chr(13) & Chr(10) >> guess I don't need that but now I have to type vbcrlf instead of crlf. > > No, you don't need it. Note that VB.NET has a 'ControlChars.NewLine' > constant too, and 'Environment.NewLine' will return the system's new line > character. > > -- > M S Herfried K. Wagner > M V P <URL:http://dotnet.mvps.org/> > V B <URL:http://classicvb.org/petition/> You saw it probably already, I forgot the :-)
Cor Show quoteHide quote "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> schreef in bericht news:umfpW2YeGHA.3572@TK2MSFTNGP03.phx.gbl... > Herfried, > > I once asked you to make a testset and you told than that you had not the > time to type that. > > Why are you advicing that long code, while there is that simple vbcrlf. > > In C# I find the 'ControlChars.NewLine' a very good alternative for the > literal. But VB has a better solution for that. > > Cor > > "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> schreef in bericht > news:OBLK0UTeGHA.4040@TK2MSFTNGP05.phx.gbl... >> "cj" <cj@nospam.nospam> schrieb: >>>I didn't know vbcrlf existed. At the top of some of my programs I have >>> dim crlf as string = Chr(13) & Chr(10) >>> guess I don't need that but now I have to type vbcrlf instead of crlf. >> >> No, you don't need it. Note that VB.NET has a 'ControlChars.NewLine' >> constant too, and 'Environment.NewLine' will return the system's new line >> character. >> >> -- >> M S Herfried K. Wagner >> M V P <URL:http://dotnet.mvps.org/> >> V B <URL:http://classicvb.org/petition/> > > Is controlchars.newline available in both VB and C#? If so perhaps
Herfried is promoting using something that would be the same from language to language. VB also has vbNewLine. Frankly everything is getting long. I almost stuck with dimming my own, crlf, as it is 4 chars instead of vbCrLf's 6. And actually thought about using nl for newline but it wasn't quite as obvious when reading the code. Anyway I went with vbCrLf as it doesn't need a dim and I'll get used to it. Cor Ligthert [MVP] wrote: Show quoteHide quote > You saw it probably already, I forgot the :-) > > Cor > > "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> schreef in bericht > news:umfpW2YeGHA.3572@TK2MSFTNGP03.phx.gbl... >> Herfried, >> >> I once asked you to make a testset and you told than that you had not the >> time to type that. >> >> Why are you advicing that long code, while there is that simple vbcrlf. >> >> In C# I find the 'ControlChars.NewLine' a very good alternative for the >> literal. But VB has a better solution for that. >> >> Cor >> >> "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> schreef in bericht >> news:OBLK0UTeGHA.4040@TK2MSFTNGP05.phx.gbl... >>> "cj" <cj@nospam.nospam> schrieb: >>>> I didn't know vbcrlf existed. At the top of some of my programs I have >>>> dim crlf as string = Chr(13) & Chr(10) >>>> guess I don't need that but now I have to type vbcrlf instead of crlf. >>> No, you don't need it. Note that VB.NET has a 'ControlChars.NewLine' >>> constant too, and 'Environment.NewLine' will return the system's new line >>> character. >>> >>> -- >>> M S Herfried K. Wagner >>> M V P <URL:http://dotnet.mvps.org/> >>> V B <URL:http://classicvb.org/petition/> >> > > "cj" <cj@nospam.nospam> schrieb: No, 'ControlChars.NewLine' is part of "Microsoft.VisualBasic.dll".> Is controlchars.newline available in both VB and C#? > language to language. VB also has vbNewLine. Frankly everything is Well, you could import the 'ControlChars' type and then use 'NewLine' and > getting long. I almost stuck with dimming my own, crlf, as it is 4 chars > instead of vbCrLf's 6. 'CrLf' throughout your code, without any bad performance implications. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> schrieb: Well, first, we have to distinguish between methods/properties to determine > I once asked you to make a testset and you told than that you had not the > time to type that. > > Why are you advicing that long code, while there is that simple vbcrlf. > > In C# I find the 'ControlChars.NewLine' a very good alternative for the > literal. But VB has a better solution for that. the system's new line character and on getting a system-independent new line character sequence. The first can be done using 'Environment.NewLine' in both VB.NET and C#. For the latter there are different ways in VB.NET and C#. In C# typically new line character sequences are embedded as escape codes inside string literals: \\\ string s = "Hello\r\nWorld" /// The equivalent code in VB.NET would be \\\ Dim s As String = "Hello" & ControlChars.CrLf & "World" /// or alternatively \\\ Dim s As String = "Hello" & vbCrLf & "World" /// 'vbNewLine' and 'ControlChars.NewLine' both are constants which have the same value as 'vbCrLf'. IIRC 'vbNewLine' has been introduced in VBA once to support /different/ newline character sequences in VBA on Windows and on the Mac. Personally I generally prefer 'ControlChars.NewLine' or 'vbNewLine' over 'ControlChars.CrLf' and 'vbCrLf' because its name is semantically more meaningful and I do not care about the value of the constant too much. However, if the exact character codes are important, then I prefer 'CrLf' and 'vbCrLf'. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> LOL
Show quoteHide quote "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> schreef in bericht news:ub3uc1beGHA.2076@TK2MSFTNGP04.phx.gbl... > "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> schrieb: >> I once asked you to make a testset and you told than that you had not the >> time to type that. >> >> Why are you advicing that long code, while there is that simple vbcrlf. >> >> In C# I find the 'ControlChars.NewLine' a very good alternative for the >> literal. But VB has a better solution for that. > > Well, first, we have to distinguish between methods/properties to > determine the system's new line character and on getting a > system-independent new line character sequence. The first can be done > using 'Environment.NewLine' in both VB.NET and C#. For the latter there > are different ways in VB.NET and C#. In C# typically new line character > sequences are embedded as escape codes inside string literals: > > \\\ > string s = "Hello\r\nWorld" > /// > > The equivalent code in VB.NET would be > > \\\ > Dim s As String = "Hello" & ControlChars.CrLf & "World" > /// > > or alternatively > > \\\ > Dim s As String = "Hello" & vbCrLf & "World" > /// > > 'vbNewLine' and 'ControlChars.NewLine' both are constants which have the > same value as 'vbCrLf'. IIRC 'vbNewLine' has been introduced in VBA once > to support /different/ newline character sequences in VBA on Windows and > on the Mac. > > Personally I generally prefer 'ControlChars.NewLine' or 'vbNewLine' over > 'ControlChars.CrLf' and 'vbCrLf' because its name is semantically more > meaningful and I do not care about the value of the constant too much. > However, if the exact character codes are important, then I prefer 'CrLf' > and 'vbCrLf'. > > -- > M S Herfried K. Wagner > M V P <URL:http://dotnet.mvps.org/> > V B <URL:http://classicvb.org/petition/>
Frustrated trying to use "pure" VS.NET to access database properties
ADO.NET Error Detect if Themes are enabled? Export to excel without using office automation SQLConnection Setting focus Dynamically Create Timers are Run-Time VB Express - How to access query value on my form? VS2003 and VS2005 Side by Side Databinding 2 comboboxes to the same Datasource |
|||||||||||||||||||||||