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: