String functions from VB6

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
 
A

Armin Zingler

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
 
A

Armin Zingler

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
 
H

Herfried K. Wagner [MVP]

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.
 
C

Cor Ligthert[MVP]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top