Home All Groups Group Topic Archive Search About

Passing dataset inputs to a winforms app

Author
23 Nov 2004 8:25 AM
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.

--
Message posted via http://www.dotnetmonster.com

Author
23 Nov 2004 11:02 AM
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



Show quote
"Prashant Kumar via DotNetMonster.com" <fo***@DotNetMonster.com> wrote in
message news:3ea1c0f1287a4802a80f5958f5db1e6b@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.
>
> --
> Message posted via http://www.dotnetmonster.com

AddThis Social Bookmark Button