Development Desk

Just another site

Monthly Archives: May 2011

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