3

これはすでに何千回も答えられている基本的な質問であることを私は知っていますが、私はそれを機能させることができません。

Visual Studio 2010で作業しており、Windowsアプリケーションに2つのフォームがあります。最初のもの(Main.vb)では、ユーザーが入力を入力し、計算が行われます。2つ目(DataAnalysis.vb)では、計算結果が表示されます。

Main.vbで、すべての中間計算ステップを含む一時テーブルを作成します。

Dim tableTempJDL As DataTable = New DataTable("TempJDL")
Dim column As DataColumn

column = New DataColumn("ID", GetType(System.Int32))
tableTempJDL.Columns.Add(column)

column = New DataColumn("PthObjekt", GetType(System.Double))
tableTempJDL.Columns.Add(column)

'further columns are after created using the same method

次に、DataAnalysis.vbで、DataTabletableTempJDLDataGridViewBerechnung:に表示しようとします。

Public bindingSourceBerechnung As New BindingSource()
Me.DataGridViewBerechnung.DataSource = Me.bindingSourceBerechnung

しかし、DataGridViewを埋める方法がわかりません...

4

1 に答える 1

3

簡単に言うと、次の方法で、バインディングソースのデータソースとしてテーブルを作成できます。

 Me.bindingSourceBerechnung .DataSource = tableTempJDL

後で、次の方法でdatagridviewの上記のバインディングソースをバインドできます。

 Me.DataGridViewBerechnung.DataSource = Me.bindingSourceBerechnung 
于 2012-08-27T12:07:37.370 に答える