次の方法で共有


RemoteBindableComponent.BindingContext プロパティ (2007 System)

更新 : 2007 年 11 月

コンポーネントの System.Windows.Forms.BindingContext を取得または設定します。

名前空間 :  Microsoft.VisualStudio.Tools.Office
アセンブリ :  Microsoft.Office.Tools.v9.0 (Microsoft.Office.Tools.v9.0.dll 内)

構文

'宣言
<BrowsableAttribute(False)> _
Public Property BindingContext As BindingContext
'使用
Dim instance As RemoteBindableComponent
Dim value As BindingContext

value = instance.BindingContext

instance.BindingContext = value
[BrowsableAttribute(false)]
public BindingContext BindingContext { get; set; }

プロパティ値

型 : System.Windows.Forms.BindingContext

実装

IBindableComponent.BindingContext

解説

コンポーネントの System.Windows.Forms.BindingContext オブジェクトを使用すると、コンポーネントが持つすべてのデータ バインド コンポーネントに対して 1 つの BindingManagerBase オブジェクトが返されます。BindingManagerBase オブジェクトは、同じデータ ソースにバインドされたすべてのコンポーネントの同期を保ちます。たとえば、BindingManagerBasePosition プロパティを設定すると、すべてのデータ バインド コンポーネントのポイント先である基底のリスト内の項目を指定できます。

ButtonClick イベント用ハンドラのコード例を次に示します。このコード例では、Button がクリックされた場合に、BindingContext プロパティを使用して NamedRange に次のデータ バインド項目を表示します。次のコード例は、RemoteBindableComponent クラス用のより大きなコード例の一部です。

' Displays the next data item in the NamedRange.
Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) _
    Handles button1.Click

    If Not (namedRange1.BindingContext Is Nothing) Then
        Dim bindingManager1 As BindingManagerBase = _
            namedRange1.BindingContext(ds, "Customers")

        ' Display the next item.
        If bindingManager1.Position < bindingManager1.Count - 1 Then
            bindingManager1.Position += 1

            ' Display the first item.
        Else
            bindingManager1.Position = 0
        End If
    End If
End Sub
// Displays the next data item in the NamedRange.
void button1_Click(object sender, EventArgs e)
{
    if (namedRange1.BindingContext != null)
    {
        BindingManagerBase bindingManager1 =
            namedRange1.BindingContext[ds, "Customers"];

        // Display the next item.
        if (bindingManager1.Position < bindingManager1.Count - 1)
        {
            bindingManager1.Position++;
        }

        // Display the first item.
        else
        {
            bindingManager1.Position = 0;
        }
    }
}

アクセス許可

  • 直前の呼び出し元に対する完全な信頼。このメンバは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

参照

RemoteBindableComponent クラス

RemoteBindableComponent メンバ

Microsoft.VisualStudio.Tools.Office 名前空間