I have 3 Forms
base - contains two Panel (Panel1 and Panel2)
Immagini
Note - contain a TextBox
Note is usable from base and Immagini
the goal is to write text on TextBox both from base and from Images calling ShowNote
From base all ok
from Images it is executed but has no effect TextBox does not display the new text
[edit]
Added as a solution by the OP:
There are 3 modules A, B, C
A - container with Panel
B - displays thumbnails
C - manages the notes of each thumbnail
D - other managements that require C
the main one is A (form), B is a Panel on A (1 panel + 1 picturebox + 1 label , for each thumbnail)
at each click on a thumbnail, displays on C the notes where they can be modified.
the scheme is A->B->C , A->D->C, C is always next to A
C - has an event which is triggered at every Keys.Enter modification, which returns to A which takes care of writing the text on C - TexBox, same thing with D
to have a Form visualized inside a Panel, doesn't create problems, it is created and destroyed when needed, but it offers the advantage to create the controls in visual way and to position them (Panel, Button, Label), after all C# doesn't have a Frame control (TFrame in Delphi)
[/edit]
What I have tried:
using Note;
using Immagini;
namespace Base
{
public partial class Form1 : Form
{
frmNote gesNote = new frmNote();
frmImmagini gesImg = new frmImmagini();
private void Form1_Load(object sender, EventArgs e)
{
gesNote.TopLevel = false;
gesNote.Top = 0;
gesNote.Left = 0;
gesNote.Height = panel2.Height;
gesNote.Width = panel2.Width;
this.panel2.Controls.Add(gesNote);
gesNote.Show();
gesNote.BringToFront();
gesNote.ShowNote("first text");
gesImg.TopLevel = false;
gesImg.Top = 0;
gesImg.Left = 0;
gesImg.Height = panel1.Height;
gesImg.Width = panel1.Width;
this.panel1.Controls.Add(gesImg);
gesImg.Show();
gesImg.BringToFront();
gesImg.ShowImg();
}
---- Form Note -----
namespace Note
public void ShowNote(string testo)
{
textBox1.Text = testo;
}
---- Form Immagini -----
using Note;
namespace Immagini
{
public partial class frmImmagini : Form
{
frmNote gesNote = new frmNote();
public frmImmagini()
{
InitializeComponent();
}
public void ShowImg()
{
gesNote.ShowNote("new text");
}
}
}