Bonjour,

J'ai déclaré un string dans mon Form1, et je souhaite modifier ce string depuis une Form2.
Comment faite ?

Merci

Tintin92

Mon code qui ne compile pas.


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
    public partial class Form1 : Form
    {
        public string strTest;
 
        public Form1()
        {
            InitializeComponent();
        }
 
        private void button1_Click(object sender, EventArgs e)
        {
            Form2 frm = new Form2();
            frm.Show();
        }

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
 
        private void button1_Click(object sender, EventArgs e)
        {
             Form1.strTest = textBox1.Text;
        }