c# - how to pass a datatable to a new form in windowsce -
i trying pass datatable new form, having null reference exception. dont understand why. sql returning many rows , sure not empty. here code
system.data.sqlserverce.sqlcedataadapter dap = new system.data.sqlserverce.sqlcedataadapter(stringsql, conn); datatable dt2 = new datatable(); dap.fill(dt2); cariselection f = new cariselection(dt2); // form f.showdialog();
what doing wrong?
here form constructor.
public cariselection(datatable dt) { datagrid1.datasource = dt; // getting null reference exception here }
i think have run initializecomponent() call before can access components on form.
public cariselection(datatable dt) { initializecomponent() datagrid1.datasource = dt; // getting null reference exception here }
Comments
Post a Comment