Re: string concatenation

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Jay B. Harlow [MVP - Outlook] (Jay_Harlow_MVP_at_msn.com)
Date: 10/05/04


Date: Tue, 5 Oct 2004 12:00:49 -0500

Bonj,
>> + is also used to concatenate strings in VB6!
>
> I know, but only in BAD VB6.

IMHO Then there's your answer...

> Coming from C# I was unaware whether & might be used for binary bitmask
> and,
> but it seems the word "And" is what's used?
& : string concatenation
And : bitwise and
AndAlso : logical short circuit and
Or : bitwise or
OrElse : logical short circuit or

FWIW: Paul Vick's "The Visual Basic .NET Programming Language" from Addison
Wesley
is a good (right size, right content) desk reference to the VB.NET language
itself. Paul's book covers just the language, not the framework.

Hope this helps
Jay

"Bonj" <Bonj@discussions.microsoft.com> wrote in message
news:23706DBB-98C1-4D67-B8C5-96B5080F05A7@microsoft.com...
>> Bonj,
>> + is also used to concatenate strings in VB6!
>
> I know, but only in BAD VB6.
>
>
>> I use & as it is the concatenation operator, while + is the addition
>> operator.
>
> Coming from C# I was unaware whether & might be used for binary bitmask
> and,
> but it seems the word "And" is what's used?
> (If you ask why I go from C# to VB.NET, it's because the amount of times
> I've typed "using SYstem ..." and done a load of backspaces and retyped
> it
> with "using System... " I must be able to write one more complete project
> per
> year.)
>
>>
>> If you have Option Strict Off, the + may convert its arguments to or from
>> String first before performing the Addition.
>
> I always have option strict on.
>
>>
>> StringBuilder has its place as does + and &. If I have a loop I will use
>> a
>> StringBuilder, where as if I have a single line I will probably use &.
>>
>> Of course if profiling proved that one was performing badly in a specific
>> routine, I would try the other to see if that improved performance.
>>
>> I would not combine StringBuilder and & in a single line, such as
>> concatenating two strings to pass to StringBuilder.Append, as that is
>> rarely
>> correct...
>>
>> Hope this helps
>
> Yes, thanks very much
>
>



Relevant Pages

  • RE: Converting VB6 Fileopen/input/close to vb.net
    ... swallow and spit it out as a single string. ... stand alone components set for those VB6 file methods(such as FileOpen, ... Dim file_num As Integer = FreeFile ... For standard binary file read/write, in .NET, you can use BinaryReader ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Use of Mid Statement in VB.Net
    ... Dim buffer as New String(" "c, ... If you use VB6, then stick to your own group. ... Microsoft for the change in the language paradigm that VB.Net introduced. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Converting Quick Basic to Visual Basic
    ... "Bill McCarthy" wrote in message ... VB3 or earlier applications cannot be opened directly by VB6 IDE, and also require replacement of control libraries etc, etc. ... You still declare a String the same way and you assign and use strings the same way. ... could you imagine if every object had to have an ansi string property and a unicode string property for each property. ...
    (microsoft.public.vb.general.discussion)
  • Re: Using a dll vs. ocx
    ... The wrapper for VB6 appears to be a class. ... dll command in VFP. ... DECLARE integer AUDIOAnalyzeFile IN "AudioGenie2.dll" string ...
    (microsoft.public.fox.programmer.exchange)
  • Re: COM interop and Object Required
    ... string String ... int Long ... public class ComObject: IComInterface ... In VB6 I have added a reference to this class. ...
    (microsoft.public.dotnet.languages.csharp)