vb.netsaverichtextboxsavefiledialog

Impossible to get the RichTextBox from the Selected Tab


My program is almost finished, which is a multi-tabbed Notepad, and i can't get to work saving the RichTextBox of the active tab.

Screenshot

First tab has a RichTextBox called "BLACKTEXT" but the others are created dynamically by clicking "New".

new tab + new rtb (picture)

When hitting 'Save', the RichTextBox of the SelectedTab has to be saved. I tried many answers in Google. I'll grant you the option to fix it for me ([download here.rar][3]) and return it back to me, because i've been dabbling around day and night for a week with increasing frustration and that would be greatly appreciated.

Thanks, linkings


Solution

  • This code will get the one and only RichTextBox control from the currently selected TabPage of TabControl1:

    Dim selectedRichTextBox = TableControl1.SelectedTab.
                                            Controls.
                                            OfType(Of RichTextBox)().
                                            Single()