Ok...found the answer.
Thanks for the feedback. It led me in the right direction.
The code I modified was from
here.
Public Class ToolStripTextBoxWithLabel
Inherits ToolStripControlHost
Public Sub New(Optional ByVal lblText As String = "label")
MyBase.New(New ControlPanel(lblText))
End Sub
Public ReadOnly Property ControlPanelControl() As ControlPanel
Get
Return CType(Me.Control, ControlPanel)
End Get
End Property
End Class
Public Class ControlPanel
Inherits Panel
Friend WithEvents txt As New TextBox
Friend WithEvents lbl As New Label
Public Sub New(ByVal lblText As String)
Me.Height = 20
lbl.Anchor = AnchorStyles.Left Or AnchorStyles.Top Or AnchorStyles.Bottom
lbl.Text = lblText
lbl.TextAlign = ContentAlignment.BottomLeft
lbl.AutoSize = True
lbl.Height = Me.Height
lbl.Location = New Point(0, 3)
lbl.Parent = Me
txt.Anchor = AnchorStyles.Left Or AnchorStyles.Right Or AnchorStyles.Top
txt.Location = New Point(lbl.Right + 3, 0)
txt.Width = Me.Width - txt.Left
txt.Parent = Me
End Sub
End Class
And here's how to call it...
Dim tb_LicenseKey As New ToolStripTextBoxWithLabel("License Key:")
tb_LicenseKey.Name = "tb_LicenseKey"
OptionMenu.DropDownItems.Add(New ToolStripSeparator)
OptionMenu.DropDownItems.Add(tb_LicenseKey)
tb_LicenseKey.BackColor = Color.FromArgb(246, 246, 246)
In my application, OptionMenu is a ToolStripMenuItem.
If anyone has any suggestions to improve this, please let me know and I'll update the posting.
Again...thanks for the input.
- KW