En general je cherche avant de poster, j'etais tombé dessus mais ca me plaisait pas trop, j'ai trouvé plus simple :
bon le code de la form1 :
using
System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace test
{
publicpartialclassForm1 :
Form
{
public Form1()
{
InitializeComponent();
}
privatevoid button1_Click(object sender, EventArgs e)
{
Form2 frm2 = newForm2(this);
frm2.ShowDialog();
}
publicstring retour()
{
return textBox1.Text;
}
}
et celui de la form2 :
using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Text;
using
System.Windows.Forms;
namespace
test
{
public
partial
class
Form2
:
Form
{
privateForm1 frm1;
public
Form2()
{
InitializeComponent();
}
public Form2(Form1 f1):this()
{
frm1 = f1
}
private
void
Form2_Load(
object
sender,
EventArgs
e)
{
textBox1.Text = frm1.retour();
}
}
}
Je pense que c'est quand meme le moins lourd qu'en pensez vous ?? et merci beaucoup SharpMao de m'avoir mis sur la voie