To set and get Single value of any Data member using property

Pradeep Raturi
Posted by Pradeep Raturi under Windows Forms category on | Points: 40 | Views : 1138
Form Code
namespace properties
{
Public partial Class Form1 : Form
{
Public Form1()
{
initalize component();

}
prop obj = new prop();
private void button_Click(object sender , EventArgs e)
{
obj.I = int.Parse(textBox1.Text);
}
private void button_Click)(object Sender , EventArgs e)
{
textBox2.Text = obj.I.ToString();
}
}
}

Class Code

namespace properties
{
Class prop
{
int i;
public int I;
{
set
{
i = value ;
}
get
{
return i ;
}
}
}
}

Comments or Responses

Login to post response