TextBox tb = new TextBox();
public string Texto
{
get
{
return (tb.Text);
}
set
{
tb.Text = value;
}
}
private void OpenFile(object sender, EventArgs e)
{
Size = new Size(400, 600);
tb.Parent = this;
tb.Dock = DockStyle.Fill;
tb.Multiline = true;
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
openFileDialog.Filter = "Textdateien (*.txt)|*.txt|Alle Dateien (*.*)|*.*";
if (openFileDialog.ShowDialog(this) == DialogResult.OK)
{
string FileName = openFileDialog.FileName;
string filetext = File.ReadAllText(FileName);
Form childForm = new Form();
childForm.MdiParent = this;
Texto = filetext;
tb.Text = filetext;
childForm.Text = Texto;
childForm.Show();
}
}
I tried to integrate a textbox, but I didn't succied. Can somebudy help me with this application.
Some code in mdiparent1.cs:
Ahmed SamirPosted Jul 15, 2025, 3:36 PM
1) Which line causes the problem?
2) Where is the problem in your code exactly?
3) At what part of your code does your TextBox should be added to the newly created Form 'childForm'?
Andreas JungPosted Jul 17, 2025, 2:56 PM
Hello, I have already done it, I am finished with this topic.