Home All Groups Group Topic Archive Search About
Author
20 Aug 2006 8:34 PM
Lost
Are fixed length strings available in VB.Net?

In Quickbasic, fixed length strings could be declared thus:

DIM str AS STRING * 10   'gives a string of length 10

Is there some equivalent command in VB.Net Express?

--
This is soc.men, we know better. -- Michael Snyder

Author
20 Aug 2006 9:45 PM
GhostInAK
Hello Lost,

http://www.google.com/search?hl=en&q=vb.net+fixed+length+strings

-Boo


Show quoteHide quote
> Are fixed length strings available in VB.Net?
>
> In Quickbasic, fixed length strings could be declared thus:
>
> DIM str AS STRING * 10   'gives a string of length 10
>
> Is there some equivalent command in VB.Net Express?
>
Author
20 Aug 2006 10:35 PM
Herfried K. Wagner [MVP]
"Lost" <lostag***@mailinator.com> schrieb:
> Are fixed length strings available in VB.Net?

Yes and no.  Could you describe the scenario in more detail?  Maybe there is
a better solution than a fixed-length string.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
20 Aug 2006 11:51 PM
J. Moreno
Lost <lostag***@mailinator.com> wrote:

> Are fixed length strings available in VB.Net?
>
> In Quickbasic, fixed length strings could be declared thus:
>
> DIM str AS STRING * 10   'gives a string of length 10
>
> Is there some equivalent command in VB.Net Express?

There's no equivalent, but it's trivially easy to limit either the value
assigned to a variable, or the result of "reading" from a variable.

Show some code and someone will probaby have a more detailed suggestion.

--
J. Moreno
Author
21 Aug 2006 3:18 PM
Lost
J. Moreno <pl***@newsreaders.com> wrote:

>Lost <lostag***@mailinator.com> wrote:
>
>> Are fixed length strings available in VB.Net?
>>
>> In Quickbasic, fixed length strings could be declared thus:
>>
>> DIM str AS STRING * 10   'gives a string of length 10
>>
>> Is there some equivalent command in VB.Net Express?
>
>There's no equivalent, but it's trivially easy to limit either the value
>assigned to a variable, or the result of "reading" from a variable.

That's what I've done as a workaround.

Thanks to everyone who answered.


--
This is soc.men, we know better. -- Michael Snyder
Author
22 Aug 2006 6:36 AM
HKSHK
Hello Lost,

> Are fixed length strings available in VB.Net?

There is.

<VBFixedString(YourStringLength)>

Taken from http://msdn2.microsoft.com/en-us/library/x14b6s77.aspx


Structure Person
     Public ID As Integer
     Public MonthlySalary As Decimal
     Public LastReviewDate As Long
     <VBFixedString(15)> Public FirstName As String
     <VBFixedString(15)> Public LastName As String
     <VBFixedString(15)> Public Title As String
     <VBFixedString(150)> Public ReviewComments As String
End Structure

Best Regards,

HKSHK
Author
22 Aug 2006 9:08 PM
Lost
HKSHK <hk***@gmx.net> wrote:

Show quoteHide quote
>Hello Lost,
>
>> Are fixed length strings available in VB.Net?
>
>There is.
>
><VBFixedString(YourStringLength)>
>
>Taken from http://msdn2.microsoft.com/en-us/library/x14b6s77.aspx
>
>
>Structure Person
>     Public ID As Integer
>     Public MonthlySalary As Decimal
>     Public LastReviewDate As Long
>     <VBFixedString(15)> Public FirstName As String
>     <VBFixedString(15)> Public LastName As String
>     <VBFixedString(15)> Public Title As String
>     <VBFixedString(150)> Public ReviewComments As String
>End Structure

Thank you.

--
This is soc.men, we know better. -- Michael Snyder