0

how to pass variable values between two class in different projects

project1

form1.cs// ui tier

      bb obj= new bb();
      cc objc = new cc();
      obj._Pur_Net_Total_Amount="fun";
      objc.method();

project2

class2.cs // business tier

class bb()  
{
    string Net_Total_Amount = string.Empty;
    public string _Pur_Net_Total_Amount
    {
        get { return Net_Total_Amount; }
        set { Net_Total_Amount = value; }
    }
}

project 2

form3.cs // business tier

class cc()
{
    bb obj = new bb();
    method()
    {
    textbox1.text=obj._Pur_Net_Total_Amount;//here i'm not getting "fun" strin
    }
}
albusshin
  • 3,930
  • 3
  • 29
  • 57
Jana
  • 49
  • 3
  • 8

1 Answers1

0

the bb object your using in class cc is not the same you instantiate in form1 - you can pass the object to method in class cc to use it.

form1.cs// ui tier

bb obj= new bb();
cc objc = new cc();
obj._Pur_Net_Total_Amount="fun";
objc.method(obj);

and

class cc()
{
  method(bb obj)
  {
    textbox1.text=obj._Pur_Net_Total_Amount;//here i'm not getting "fun" strin
  }
}
Morten Anderson
  • 2,301
  • 15
  • 20