Library code snippets
String Concatenation
To join two strings together in Visual Basic, you use the & operator. For example,
sString = "hello " & sName
Combines the text "hello " and the value of sName, and saves it in the sString variable. An operator that is notably missing in VB 6 an earlier is a way to append a string to another. In VB 6 or earlier, you have to do
sString = sString & " goodbye!"
Which adds " goodbye" to the end of sString. However, this can be extremely inefficient when performing the operation multiple times, or on large strings. (For performance comparisons with a C++ equivilant, take a look here). Fortunately, with VB.NET, the language has been brought into line with most others, and you can now do
sString .= " goodbye!"
instead.
Related articles
Related discussion
-
Run-time error '91'
by converter2009 (1 replies)
-
VB6 Runtime error 381 subsript out of range Error
by Uncle (2 replies)
-
passing and reading parameters from using Shell
by jigartoliya (0 replies)
-
Convert C++ code to VB6
by mawcot (4 replies)
-
listbox scrollbar
by Dennijr (10 replies)
Related podcasts
-
Christian Beauclair
14 mai 2008 (�mission #0074) ::.Christian Beauclair: Stratégies de migration VB6 vers .NET Nous discutons avec Christian Beauclair des stratégies de migration VB6 vers .NET. Entre autres, nous discutons comment utiliser le "VB 6 Code Advisor" et le "Interop Forms Toolkit" pour ajouter la puiss...
say uve got three string in a sentance time|title|location , there broken by the | how would u split the three strings in 3 individual strings again??
i know how to find info before and after a | but not breaking down three strings
any help would be appreciated
This thread is for discussions of String Concatenation.