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

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -