通过


FixedLengthString.Value 属性

定义

获取或设置一个 FixedLengthString. 的内容。

public:
 property System::String ^ Value { System::String ^ get(); void set(System::String ^ value); };
public string Value { get; set; }
member this.Value : string with get, set
Public Property Value As String

属性值

包含值的 A String

示例

下面的示例演示如何声明和使用 a FixedLengthString.

Private Sub DemoFixedLengthString()
    ' Declare a string that has a length of 7 characters and assign the
    ' initial string. The additional 5 positions will be padded with
    ' spaces.
    Dim fixedString As New FixedLengthString(7, "He")
    ' Display the string in a message box.
    MsgBox(fixedString.ToString)
    ' Assign a new value to the string.
    fixedString.Value = "Hello World"
    ' Display again. Note that only the first 7 characters are shown.
    MsgBox(fixedString.ToString)
End Sub

注解

FixedLengthString 类可用于模拟 Visual Basic 6.0 字符串的行为,这使你可以声明长度固定的字符串。 不能将 A FixedLengthString 转换为 ; String必须引用 Value 属性或调用 ToString 方法以转换类型。

注释

命名空间中的 Microsoft.VisualBasic.Compatibility.VB6 函数和对象由用于从 Visual Basic 6.0 升级到 Visual Basic 2008 的工具使用。 在大多数情况下,这些函数和对象重复了可在 .NET Framework 中的其他命名空间中找到的功能。 仅当 Visual Basic 6.0 代码模型与 .NET Framework 实现明显不同时,才需要它们。

适用于