开发者

The targeted version of the .net compact framework does not support late binding warning?

开发者 https://www.devze.com 2023-01-01 13:47 出处:网络
i am developing a mobile application on visual studio 2008under .net compact framework for windows ce platform.

i am developing a mobile application on visual studio 2008 under .net compact framework for windows ce platform. i use vb.net language

i want to add a new row to datatable using Bindingsource object. my code is

Me.BindingSource1.AddNew()

开发者_C百科Me.StokBindingSource1.Current("id") = "01"

when i use Current methot of bindingsource it gives error and says The targeted version of the .net compact framework does not support late binding

How can i determine the field to add a value?


Erm... you're trying to add via the bindingsource? I'd suggest trying to update the original datasource itself instead and then calling .RefreshBindings(false) on the BindingSource.

e.g. (psuedo - sorry it's 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);
}

Something like that anyway.... out of interest... why are you manually entering in the id? Typically one would get this from the database... no?

0

精彩评论

暂无评论...
验证码 换一张
取 消