Hi !!!

I have two Windows Forms. In First Windows Form i have one Text Box and one Button. In the Second Windows Form i wish to call First Windows Form and get the value of Text Box. Is this is possible? When i create a object of the First Windows Form in Second Windows Form and I try to call property Text of Text Box, every time is Empty.

Recommended Answers

All 7 Replies

Hi,
Use Cookie or session as http.
If you need code for C# or VB write me <EMAIL SNIPPED>

I talking for Windows Forms dude not for ASP.

:) Thank you very much. :) I'll mark this post as Solved !!! Thank you again !!!

The snippet of Ryshad is very good!
Yet another snippet out of the snippet section is this one

in form2.cs

public Form2()
        {
            InitializeComponent();
        }
        public Form2(string s)
        {
            InitializeComponent();
            textBox1.Text = s;
        }

in form1.cs

        Form2 f = new Form2(textBox1.Text);
        f.Show();

marked textbox with public keyword and also use a static variable to store textbox data.
now you can use this textbox and it's data in next or other forms.

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.