Development Desk

Just another WordPress.com site

How to access windows form controls from another Form.

let suppose you have two windows forms open.

1st is frmRegistration

2nd is frmLogin

suppose there is Label control on the registration form named as lblIsRegistered and you want to access this control on the Login form.

firstly, you need to go into the properties of the lblIsRegistered label and check its Access modifier which will be private by default.

just make it Public.

secondly, on the login form make object of registration form like

frmRegistration registrationForm = new frmRegistration();

then access its public control e.g. String isRegisterCheck =  registrationForm.lblIsRegistered.Text;

Thank you very much

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: