Expose a public property of type Form, from B. Assign A
to the public property. Then B has a reference to A, you
can iterate the controls collection to identify your
target control and manipulate it as you wish.
I'm sure there's a more elegant solution, but this will
work in the interim.
[quoted text, click to view] >-----Original Message-----
>Hi,
>
>I have a form (FormA) which was loaded using
Application.Run when my app
>loads. This form has a button which loads Form B
using "FormB myForm=new
>FormB()". My question is, how do I access and modify the
value of a control
>on FormA from FormB?
>
>I thought this would be easy but I was wrong.
>
>Cheers,
>
>John
>
>
>.
Hi,
I have a form (FormA) which was loaded using Application.Run when my app
loads. This form has a button which loads Form B using "FormB myForm=new
FormB()". My question is, how do I access and modify the value of a control
on FormA from FormB?
I thought this would be easy but I was wrong.
Cheers,
John
if in FormB's constructor you have a param which receieves a referance of a
form control.
then when you call FormB from FormA use the this keyword to pass the
referance.
FormB will then be able to access public elements in FormA.
[quoted text, click to view] "JSM" <123@123.com> wrote in message
news:uALxrCbXDHA.1872@TK2MSFTNGP12.phx.gbl...
> Hi,
>
> I have a form (FormA) which was loaded using Application.Run when my app
> loads. This form has a button which loads Form B using "FormB myForm=new
> FormB()". My question is, how do I access and modify the value of a
control
> on FormA from FormB?
>
> I thought this would be easy but I was wrong.
>
> Cheers,
>
> John
>
>