Hello! First Sorry for my bad English. I have three classes and I need to save my var userId in my form . First Class is:
private void buttonOk_Click(object sender, EventArgs e)
{
UserEntity user = new UserEntity(textBoxUsername.Text,textBoxPassword.Text);
if (user.getUser()) {
MainPanel mp = new MainPanel();
mp.User = user;
mp.Show();
}
When the button is clicked we go to Second class:
private void ProfitPanelButton_Click(object sender, EventArgs e)
{
UserEntity user = new UserEntity();
if (user.getUser())
{
ProfitPanel pp = new ProfitPanel();
pp.User = user;
pp.Show();
}
else
{
MessageBox.Show("ERROR");
}
}
When We clicked ProfitPanelButton go to profit and insert Profit into DB .
I don't have any problem with going from 1st button directly to 3rd with code :
private void buttonOk_Click(object sender, EventArgs e)
{
UserEntity user = new UserEntity(textBoxUsername.Text,textBoxPassword.Text);
if (user.getUser()) {
ProfitPanel pp = new ProfitPanel();
pp.User = user;
pp.Show();
}
}
Can you help me to fix this problem or give me some idea. Thanks.