This should be so easy it's embarassing, but I've looked & looked on the
inet...
What's the equivalent in VB .NET of the old Basic String$() function?
To create string of 1000 zeros, you'd do

a$=string$(1000,0)

which you don't seem to be able to do in VB .NET. I thought

Dim s As String = Microsoft.VisualBasic.string(1000,0)

but it doesn't like it. Surely everyone must know but me!

(By the way, has anyone the time to look at my other thread "Deleting
from a table via a dataset positioning problem"? I'm still stuck on
that, too.)

Thanks to any assistor,


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Re: Creating a long string by Jon

Jon
Mon Mar 14 15:02:40 CST 2005

VB Learner <anonymous@devdex.com> wrote:
> This should be so easy it's embarassing, but I've looked & looked on the
> inet...
> What's the equivalent in VB .NET of the old Basic String$() function?
> To create string of 1000 zeros, you'd do
>
> a$=string$(1000,0)
>
> which you don't seem to be able to do in VB .NET. I thought
>
> Dim s As String = Microsoft.VisualBasic.string(1000,0)
>
> but it doesn't like it. Surely everyone must know but me!

There's a string constructor which takes a char and an int. Do you
really want a thousand '0' chars, or a thousand null chars (i.e.
Unicode 0)?

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Re: Creating a long string by Jim

Jim
Mon Mar 14 15:03:33 CST 2005

Dim s As New String("0"c, 1000)

the "c casts the 0 to a Character


"VB Learner" <anonymous@devdex.com> wrote in message
news:e4FVX%23MKFHA.2356@TK2MSFTNGP14.phx.gbl...
> This should be so easy it's embarassing, but I've looked & looked on the
> inet...
> What's the equivalent in VB .NET of the old Basic String$() function?
> To create string of 1000 zeros, you'd do
>
> a$=string$(1000,0)
>
> which you don't seem to be able to do in VB .NET. I thought
>
> Dim s As String = Microsoft.VisualBasic.string(1000,0)
>
> but it doesn't like it. Surely everyone must know but me!
>
> (By the way, has anyone the time to look at my other thread "Deleting
> from a table via a dataset positioning problem"? I'm still stuck on
> that, too.)
>
> Thanks to any assistor,
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



Re: Creating a long string by Herfried

Herfried
Mon Mar 14 16:50:03 CST 2005

"Jim Hughes" <NOSPAMJ3033@Hotmail.com> schrieb:
> Dim s As New String("0"c, 1000)
>
> the "c casts the 0 to a Character

Alternatively you can use 'StrDup' in VB.NET.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>