0

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?

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Harm
  • 1
  • Can you please format your code? A lot of the statements are not inside code blocks. – Sal Aug 05 '17 at 18:09
  • Learn what is type cast, and you need it to cast a generic dock content back to your own type. – Lex Li Aug 06 '17 at 16:20
  • I'm don't no what's wrong. On my computer (Win10 IE11) the code format is perfect ? – Harm Aug 06 '17 at 19:55

0 Answers0