forum

Home / DeveloperSection / Forums / How to Call Public Variable/Method From One Class To MainForm.Cs?

How to Call Public Variable/Method From One Class To MainForm.Cs?

Anonymous User 1598 27-Oct-2014
I am trying to call:
public double lose;
public void LoseWeight()
{
        lose = weight - 400;
}
to
listBox.Items.Add("calories : " + lose); //on MainForm.cs

But for some reason, I'm getting error: The name "lose" does not exist in the current context.
I thought all public variables and methods can be shared.
Is there a special rule for getting things from class -> MainForm?

.net c#  .net 
Updated on 27-Oct-2014
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By