Re: [Non-Résolu] Les problèmes d'un débutant
Message par Patak » 31 Octobre 2013, 13:53
Non, on tourne pas en rond :lol:
On approche du but !
Dans la Form principale :
private static Form1 _FormActuel;
public static Form1 FormActuel
{
get { return _FormActuel; }
set { _FormActuel = value; }
}
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
_FormActuel = this;
}
private delegate void SetTextCallback(string text);
public void SetText(string text)
{
if (InvokeRequired)
{
Invoke(new SetTextCallback(SetText), text);
}
else
{
textBoxLogs.Text += text + "\r\n";
textBoxLogs.Select(textBoxLogs.Text.Length, 0);
textBoxLogs.ScrollToCaret();
}
}
Dans les Class qui appelle :
Form1.FormActuel.SetText("Coincoin");