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

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 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC

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

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 3.5, 2.0, 1.0

Community Additions

ADD
Show:
© 2015 Microsoft