dsUni = new DataSet();
dsUni.ReadXml(pathDesc);
frm02.dgv02.DataSource = dsUni.Tables[0];
frm02.ShowDialog(); // this all works well
But - frm02.ClosingEvent:
dsUni.WriteXml(pathDesc);
error: The names dsUni and pathDesc does not exist in the current context
What should i write and WHERE - to access all the controls and all variables from frm01 to frm02 and ViceVersa?
Loading

FroglegPosted Jun 12, 2012, 3:40 AM
public partial class Form1 : Form
{
public static Form1 Fm1 = null;
public var dsUni = new DataSet();// put it here
public Form1()
{
InitializeComponent();
}
Do some research on global variables
MementoPosted Jun 12, 2012, 6:17 AM
Especially thanks for yourPatience.
MementoPosted Jun 12, 2012, 12:18 AM
- In the buttonClick Event - which calls Form 2
- In the Form1_Load
- In the Form2_Load
- Inside public frm01()
And allways - I got errors.
FroglegPosted Jun 11, 2012, 4:35 PM
public var dsUni = new DataSet();
on Form2 use
Form1.Fm1.dsUni(do whatever);
MementoPosted Jun 11, 2012, 3:23 PM
Pleas give me a solution for this case:
On the first form I have:
var dsUni = new DataSet();
dsUni.ReadXml(pathDesc);
frm02.dgv02.DataSource = dsUni.Tables[0];
frm02.ShowDialog();
On the second form I need the same DataSet(dsUni) to writeXml:
dsUni.WriteXml(pathDesc); //dsUni and pathDesc are from the first form
MementoPosted Jun 11, 2012, 7:14 AM
I'll explore your sample,
And hope - FormToForm Story will bi finally clearToMe.
FroglegPosted Jun 11, 2012, 2:55 AM