2010-06-01 71 views
0

我正在爲windows ce平臺的.net緊湊框架開發一個用於visual studio 2008的移動應用程序。 我使用vb.net語言.net壓縮框架的目標版本不支持後期綁定警告?

我想使用Bindingsource對象添加一個新的行到數據表。 我的代碼是

Me.BindingSource1.AddNew()

Me.StokBindingSource1.Current( 「ID」)= 「01」

當我使用當前的BindingSource的methot提示錯誤 並說.net精簡框架的目標版本不支持後期綁定

如何確定要添加值的字段?

回答

1

呃...你試圖通過綁定源添加? 我建議嘗試更新原始數據源本身,然後調用BindingSource上的.RefreshBindings(false)。

例如(僞 - 抱歉,這是C#)

MyDataTable table; 
BindingSource source; 

SomeKindOfInit() 
{ 
    table = new MyDataTable(); 
    source = new BindingSource(); 
    source.DataSource = table; 
    datagrid1.DataSource = source; 
} 

AddSomeStuff() 
{ 
    DataRow row = table.NewRow(); 
    row["Id"] = "01"; 
    table.Rows.Add(row); 
    source.RefreshBindings(false); 
} 

類似的東西反正....出於興趣......你爲什麼要手動在ID進入?通常情況下,人們會從數據庫中得到這個...不是?