String functions from VB6

  • Thread starter Thread starter Griff
  • Start date Start date
G

Griff

Hi

In VB6, I used to use the following functions: String$(x,y) and Space$(x).

These are still available in VB2005 as part of the
Microsoft.VisualBasic.Strings library. However, I understand that this is
available just for backwards compatibility.

I would therefore like to know how I would do this using just DOT NET
commands.

Thanks

Griff
 
Griff said:
Hi

In VB6, I used to use the following functions: String$(x,y) and
Space$(x).

These are still available in VB2005 as part of the
Microsoft.VisualBasic.Strings library. However, I understand that
this is available just for backwards compatibility.

I would therefore like to know how I would do this using just DOT
NET commands.

dim s as string=new string("x"c, 17)

(the 'c' after the quote means it's a character literal, in opposite to
a string)


Armin
 
Armin Zingler said:
dim s as string=new string("x"c, 17)

Um..

dim s as new string("x"c, 17)

or if you like the 2008 Option Infer style:

dim s =new string("x"c, 17)


Armin
 
Griff said:
In VB6, I used to use the following functions: String$(x,y) and
Space$(x).

These are still available in VB2005 as part of the
Microsoft.VisualBasic.Strings library. However, I understand that this is
available just for backwards compatibility.

That's wrong. They are just as "available just for backwards compatibility"
as the 'If' statement, for example. There is nothing wrong with using them.

Note that 'String' has been renamed to 'StrDup', and 'Space' still exists.
Instead you may also want to use the 'String' class' conststructor.
 
That's wrong. They are just as "available just for backwards
compatibility" as the 'If' statement, for example. There is nothing wrong
with using them.
However that makes is still backwards compatible.
Would be worse if it was not.

:-)

Cor
 
Back
Top