BindingSource.Add メソッド
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

Dim instance As BindingSource Dim value As Object Dim returnValue As Integer returnValue = instance.Add(value)
戻り値
List プロパティで表される基底のリストに value を追加する場所の 0 から始まるインデックス。


Add メソッドは、呼び出しを基底のリストの Add メソッドに参照します。
内部リストには、同じ種類の型を格納する必要があります。DataSource プロパティがまだ設定されていない場合は、リストに追加される最初のオブジェクトによってリストの型が決定されます。

BindingSource コンポーネントを使用して、リストを DataGridView コントロールにバインドするコード例を次に示します。リストは、Add メソッドを呼び出すことによって設定されます。
次のコード例は、「方法 : BindingSource ResetItem メソッドを使用して変更通知を発生させる」で示されている例の一部です。
Private Sub Form1_Load(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles Me.Load ' Create and populate the list of DemoCustomer objects ' which will supply data to the DataGridView. Dim customerList As List(Of DemoCustomer) = _ New List(Of DemoCustomer) customerList.Add(DemoCustomer.CreateNewCustomer()) customerList.Add(DemoCustomer.CreateNewCustomer()) customerList.Add(DemoCustomer.CreateNewCustomer()) ' Bind the list to the BindingSource. Me.customersBindingSource.DataSource = customerList ' Attach the BindingSource to the DataGridView. Me.customersDataGridView.DataSource = Me.customersBindingSource End Sub
private void Form1_Load(System.Object sender, System.EventArgs e) { // Create and populate the list of DemoCustomer objects // which will supply data to the DataGridView. List<DemoCustomer> customerList = new List<DemoCustomer>(); customerList.Add(DemoCustomer.CreateNewCustomer()); customerList.Add(DemoCustomer.CreateNewCustomer()); customerList.Add(DemoCustomer.CreateNewCustomer()); // Bind the list to the BindingSource. this.customersBindingSource.DataSource = customerList; // Attach the BindingSource to the DataGridView. this.customersDataGridView.DataSource = this.customersBindingSource; }
void Form1_Load( Object^ /*sender*/, EventArgs^ /*e*/ ) { // Create and populate the list of DemoCustomer objects // which will supply data to the DataGridView. List< DemoCustomer^ >^ customerList = gcnew List< DemoCustomer^ >; customerList->Add( DemoCustomer::CreateNewCustomer() ); customerList->Add( DemoCustomer::CreateNewCustomer() ); customerList->Add( DemoCustomer::CreateNewCustomer() ); // Bind the list to the BindingSource. this->customersBindingSource->DataSource = customerList; // Handle the ListChanged event. this->customersBindingSource->ListChanged += gcnew ListChangedEventHandler( this, &Form1::customersBindingSource_ListChanged ); // Attach the BindingSource to the DataGridView. this->customersDataGridView->DataSource = this->customersBindingSource; }

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
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からBindingSource.Add メソッドを検索する場合は、下記のリンクをクリックしてください。

- BindingSource.Add メソッドのページへのリンク