0

in form1 i have this code

 #region MaterialSize Declaration
        //public static string materialtype = "";
        private string _materialtype = "";
        private string _size = "";
        private string _kg = "";
        private string _price = "";
        private string _barcolour = "";
        private string _sizeLength = "";
        private DateTime? _datemodify;
        #endregion

i want to get their value and put all in the textbox of form2

how can i get the value in form1? please

3
Contributors
3
Replies
29
Views
4 Years
Discussion Span
Last Post by ChrisHunter
1
create a class called class1.cs

inside your public partial on both form1 and form 2 add the following
class1 myclass = new class1();


then you can pass information to your class by doing
class1.size = textbox1.text;

inside you class add the following
public static string size { get; set; }

then all you need to call on the passed variable on form2 is
label1.text = class1.size;

hope this helps
Votes + Comments
LIke!
1

define a private and public property like this:

private int _age;

public int Age
{
    get
    {
        return _age;
    }

    Set
    {
        _age = value;
    }
}

and to set the value of _age you pass the value to Age, or you can just do public int Age { get; set; )

Votes + Comments
Sheers!
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.