Export (0) Print
Expand All

VBFixedStringAttribute Class

Indicates that a string should be treated as if it were fixed length.

Namespace: Microsoft.VisualBasic
Assembly: Microsoft.VisualBasic (in microsoft.visualbasic.dll)

[AttributeUsageAttribute(AttributeTargets.Field, Inherited=false, AllowMultiple=false)] 
public sealed class VBFixedStringAttribute : Attribute
/** @attribute AttributeUsageAttribute(AttributeTargets.Field, Inherited=false, AllowMultiple=false) */ 
public final class VBFixedStringAttribute extends Attribute
AttributeUsageAttribute(AttributeTargets.Field, Inherited=false, AllowMultiple=false) 
public final class VBFixedStringAttribute extends Attribute

For more detailed information, see the Visual Basic topic VBFixedStringAttribute Class.

Visual Basic strings are of variable length by default. This attribute is useful when using Visual Basic file input and output functions such as FileGet and FilePut that require fixed length strings.

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

NoteNote

The VBFixedStringAttribute is informational and cannot be used to convert a variable length string to a fixed string. The purpose of this attribute is to modify how strings in structures and non-local variables are used by methods or API calls that recognize the VBFixedStringAttribute. Keep in mind that this attribute does not change the actual length of the string itself.

System.Object
   System.Attribute
    Microsoft.VisualBasic.VBFixedStringAttribute

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft