strTabName = "SQL Tab " & tcOnTabPageA.TabPages.Count Dim tpNew As New TabPage(strTabName) tpNew.Controls.Add(New RichTextBox) tpNew.Padding = New Padding(3) tpNew.BackColor = Color.FromKnownColor(KnownColor.Control) tpNew.ContextMenuStrip = mnuForTabs Dim rtxt As RichTextBox = CType(tpNew.Controls(0), RichTextBox) rtxt.Dock = DockStyle.Fill rtxt.Font = gblFont rtxt.BorderStyle = BorderStyle.FixedSingle rtxt.ContextMenuStrip = mnuForText rtxt.DetectUrls = False rtxt.AcceptsTab = True 'Remove handlers before adding again to ensure that the event will only be run once RemoveHandler rtxt.TextChanged, AddressOf richtextbox_TextChanged RemoveHandler rtxt.KeyDown, AddressOf FieldName_KeyDown 'Connect handlers to the proper methods AddHandler rtxt.TextChanged, AddressOf richtextbox_TextChanged AddHandler rtxt.KeyDown, AddressOf FieldName_KeyDown 'Creating a new tab page at the end tcOnTabPageA.TabPages.Insert(tcOnTabPageA.TabPages.Count - 1, tpNew)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)