Another problem with two forms [modified]
-
I have problem with the data. From my main window I click other form is opened and I want to type in some data like alarm time, but I have problem with display it in my main window. I want display it in my label but i don't how to get to that label,and other variables in my main window from my second form?? -- modified at 9:55 Saturday 27th May, 2006 examle I have somethin like this public partial class Form1 : Form { public int a, b, c; public Form1() { InitializeComponent(); } and I want to acces the a,b,c prameters from my form2.
-
I have problem with the data. From my main window I click other form is opened and I want to type in some data like alarm time, but I have problem with display it in my main window. I want display it in my label but i don't how to get to that label,and other variables in my main window from my second form?? -- modified at 9:55 Saturday 27th May, 2006 examle I have somethin like this public partial class Form1 : Form { public int a, b, c; public Form1() { InitializeComponent(); } and I want to acces the a,b,c prameters from my form2.
Ok so what you would do is hand these variables to the constructor of your second form: Ex.
public partial class Form2 : Form
{public int d, e, f;
public Form2(int a, int b, int c)
{
d = a;
e = b;
f = c;
InitializeComponent();
}...
public partial class Form1 : Form
{public int a, b, c;
public Form1()
{
InitializeComponent();
}something_OnClick()
{
Form2 frm2 = new Form2(a, b, c);
frm2.ShowDialog();
}
-
Ok so what you would do is hand these variables to the constructor of your second form: Ex.
public partial class Form2 : Form
{public int d, e, f;
public Form2(int a, int b, int c)
{
d = a;
e = b;
f = c;
InitializeComponent();
}...
public partial class Form1 : Form
{public int a, b, c;
public Form1()
{
InitializeComponent();
}something_OnClick()
{
Form2 frm2 = new Form2(a, b, c);
frm2.ShowDialog();
}
Maybe it's works, but I still don't know how to do this.
-
Maybe it's works, but I still don't know how to do this.
-
I don't know how it works. Itried to do it as you wrote, but it doesn't work. mariuszfryta