namespace Sample1
{
public partial class MainForm : Form
{
private int field1;
public MainForm()
{
InitializeComponent();
field1 = 2;
}
private void button1_Click(object sender, EventArgs e)
{
if (field1 == 2)
{
do something here;
}
else
do other;
}
How can I get the field1 value to be 2 when button1_Click method is called? Right now everytime I call field1, I get null value. I'd like to recall the value that is assigned in one method to another method. Thanks for your answer.
{
public partial class MainForm : Form
{
private int field1;
public MainForm()
{
InitializeComponent();
field1 = 2;
}
private void button1_Click(object sender, EventArgs e)
{
if (field1 == 2)
{
do something here;
}
else
do other;
}
How can I get the field1 value to be 2 when button1_Click method is called? Right now everytime I call field1, I get null value. I'd like to recall the value that is assigned in one method to another method. Thanks for your answer.