次の方法で共有


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

プロパティ値

値を含む String

次の例では、 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 文字列の動作をエミュレートできます。これにより、固定長の文字列を宣言できます。 FixedLengthStringStringに変換することはできません。Value プロパティを参照するか、ToString メソッドを呼び出して型を変換する必要があります。

Microsoft.VisualBasic.Compatibility.VB6名前空間の関数とオブジェクトは、Visual Basic 6.0 から Visual Basic 2008 にアップグレードするためのツールで使用するために提供されています。 ほとんどの場合、これらの関数とオブジェクトは、.NET Framework の他の名前空間で見つけることができる機能を複製します。 これらは、Visual Basic 6.0 コード モデルが .NET Framework の実装と大きく異なる場合にのみ必要です。

適用対象