Passing dataset inputs to a winforms app

  • Thread starter Prashant Kumar via DotNetMonster.com
  • Start date
P

Prashant Kumar via DotNetMonster.com

Hi,
I need to invoke a winforms app from another app. I do this using the System.Diagonostics.Process class.
I need to be passing a dataset as an input to the winforms app. I also need to be returning the dataset back to the calling app after some changes to the dataset are affected in the winforms.
Is there some way of doing it other than using an intermediate file to which the dataset xml can be written to ???
The problem in using a local file is that I lose my row states in the dataset. How do I handle this such that I can preserve the row states across applications?

Thanks & regards,
Pras.
 
C

ClayB [Syncfusion]

If your datasource is a DataTable, I think you can probably use the
clipboard to pass the information. Before you launch the 2nd application.
put teh datatable on teh clicpboard. Then after the 2nd application comes
up, have it retrieve teh information from teh clipboard.

private void button2_Click(object sender, System.EventArgs e)

{

DataTable dt = this.dataGrid1.DataSource as DataTable;

Clipboard.SetDataObject(new DataObject(dt), true);

}

private void button3_Click(object sender, System.EventArgs e)

{

if(Clipboard.GetDataObject().GetDataPresent(typeof(DataTable)))

{

DataTable dt =
Clipboard.GetDataObject().GetData(typeof(DataTable)) as DataTable;

this.dataGrid1.DataSource = dt;

}

}

====================================
Clay Burch, .NET MVP

Visit www.syncfusion.com for the coolest tools
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top