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

Recommended Answers

All 3 Replies

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
commented: LIke! +14

i want to make it as a private is that possible?

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; )

commented: Sheers! +14
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.