Hi
I am using VB 2010 Express.
I have the need for a Custom ComboBox where there is a TextBox placed on top of the ComboBox (replacing the ComboBox Text Area). I created the Class as shown:
My problem is that the TextBox does not show when I place the Custom control on a form. I added the TextBox to the parent container of the inherited ComboBox. I did try a UserControl with a ComboBox and TextBox but had some sizing problems with it.
Can someone tell me what I am doing wrong? I am sort of new to VB.Net and am just learning it.
Jerry Bodoff
I am using VB 2010 Express.
I have the need for a Custom ComboBox where there is a TextBox placed on top of the ComboBox (replacing the ComboBox Text Area). I created the Class as shown:
Code:
Imports System
Imports System.Windows.Forms
Imports System.Drawing
Public Class TextBoxCombo
Inherits ComboBox
Friend WithEvents ComboText As New TextBox
Private ButtonWidth As Integer = 18
Public Sub New()
ComboText.Location = New Point(Me.Location.X, Me.Location.Y)
ComboText.Size = New Size(Me.Width - ButtonWidth, Me.Height)
ComboText.BackColor = Color.LightGreen ' So I can see the TextBox
ComboText.BringToFront()
ComboText.Name = "ComboText"
Me.Parent.Controls.Add(ComboText)
End Sub
End Class
Can someone tell me what I am doing wrong? I am sort of new to VB.Net and am just learning it.
Jerry Bodoff