using public property

  • Thread starter Thread starter Fabio Negri Cicotti
  • Start date Start date
F

Fabio Negri Cicotti

Hi all,

I have 2 form (frmLogin and frmMain) and inside of frmMain I've created this
code:

private int _tmpID;

public int tmpID {
get { return _tmpID }
set { _tmpID = value; }
}

I created an instance of that form in frmLogin

Eg: Form frmTemp = new frmMain();

but I can't find the propery as "frmTemp.tmpID"

How can I see that property within frmLogin?


Thanks in advance,

Fabio Negri Cicotti
 
Fabio Negri Cicotti said:
I have 2 form (frmLogin and frmMain) and inside of frmMain I've created this
code:

private int _tmpID;

public int tmpID {
get { return _tmpID }
set { _tmpID = value; }
}

I created an instance of that form in frmLogin

Eg: Form frmTemp = new frmMain();

but I can't find the propery as "frmTemp.tmpID"

How can I see that property within frmLogin?

You need to tell the compiler that frmTemp is an instance of frmMain,
not just an instance of Form:

frmMain frmTemp = new frmMain();

You should then be able to use the property.

(You should consider following MS naming conventions, btw:
http://tinyurl.com/2cun)
 
Back
Top