DockPanelSuite, How to get the value from a TextBox on a Panel

126 Views Asked by At

I'm new with C# and making my first application with the dockpanel-suite. The main goal is to edit multiple text-files.

My question is how to get the value of a textbox on the active panel/document?

I have a standard Form (frmView) for viewing and editing the text-files. frmView has a RichTextBox (tbView) which contains the text of the selected file.

frmMain:

foreach (string cFileName in cSelection)
{
    frmView dpFile = new frmView();
    dpFile.TabText = (cFileName);
    dpFile.Show(dpAllViews.Pane, null);
    dpFile.View(cFileName);
}

frmView:

public void View(string cFileName)
{
    tbView.Text = System.IO.File.ReadAllText(cFileName);
}

public string Get_tbView
{
    get { return tbView.Text; }
}

After editing I want to save the active document if can find the active document

foreach (IDockContent content in dpMain.Documents)
{
    if (content.DockHandler.IsActivated)
    { 
        return content;
    }
} 

How can I read the value of the textbox on that panel?

0

There are 0 best solutions below