So I am trying to create a text editor for php, html, css an JS. I have a tab function that creates a new tab, and inserts a new richtextbox ready to type code. My problem is this, how do I select only the text from the currently selected tab so that the user can save their file? Here is the code for the button which creates a new tab and inserts a new RTB into the tab:
// NEW FILE TOOL
private void newTool_Click(object sender, EventArgs e)
{
// Create a new tab.
string newTabTitle = "New file " + (tabControl.TabCount + 1).ToString();
TabPage newTab = new TabPage(newTabTitle);
tabControl.TabPages.Add(newTab);
// New tab's settings.
newTab.Name = newTabTitle;
newRTBName = newTabTitle;
// Adds a new rich text box control.
RichTextBox newRTB = new RichTextBox();
newTab.Controls.Add(newRTB);
// Settings for new rich text box.
newRTB.Dock = DockStyle.Fill;
newRTB.Name = newTabTitle;
newRTB.Text = "NAME: " + newRTBName;
tmpSaveData[tabControl.TabCount] = newRTB.Text;
newRTB.Font = new Font("Courier New", 10);
}