C # uses the constructor in the child form (implementing the pass value from the parent form to the child form, but the value return of the child form is not yet implemented)

1. The constructor 
string str = String.Empty in the overloaded form Form2 ; // Receive the passed value 
        public Form2 (string textValue) 
        { 
            InitializeComponent (); 
            this.str = textValue; 
        } 
2. The main form caller When the form passes parameters: Button event of the main form Form1 
Form2 f2 = new Form2 (textBox1.Text); 
            f2.ShowDialog ();
Published 20 original articles · Likes2 · Visits 10,000+

Guess you like

Origin blog.csdn.net/qq_28335347/article/details/49995069