N
Nathan Franklin
hey guys
I am trying to write a custom control (an editable combobox), doing a lot of
research people have said the best way to do it with a text box overlayed
the combobox..
I have tryed to place this into a custom control which I would like to
reuse..
I cant seem to get the text box onto the control though.. A copy of my code
is below.
On the Me.Controls.Add(Me.txtEditable) line , it throws an argumentexception
Public Class ComboBoxEx
Inherits ComboBox
' controls used
Friend WithEvents txtEditable As TextBox
Sub New()
InitializeComponent()
End Sub
Private Sub InitializeComponent()
txtEditable = New TextBox
' default
txtEditable.MaxLength = 30
txtEditable.Bounds = MyBase.Bounds
txtEditable.Visible = True
txtEditable.BringToFront()
' finally add the textbox control to the design
Me.Controls.Add(Me.txtEditable) ' errors on this line here
'MyBase.Controls.Add(MyBase.txtEditable) ' also if this is uncommented, it
throws the same error
End Sub
Protected Overrides Sub SetItemsCore(ByVal items As
System.Collections.IList)
MyBase.SetItemsCore(items)
End Sub
End Class
If any one could help me out that would be great..
Thanks heaps guys...
Kind Regards
--Nathan
I am trying to write a custom control (an editable combobox), doing a lot of
research people have said the best way to do it with a text box overlayed
the combobox..
I have tryed to place this into a custom control which I would like to
reuse..
I cant seem to get the text box onto the control though.. A copy of my code
is below.
On the Me.Controls.Add(Me.txtEditable) line , it throws an argumentexception
Public Class ComboBoxEx
Inherits ComboBox
' controls used
Friend WithEvents txtEditable As TextBox
Sub New()
InitializeComponent()
End Sub
Private Sub InitializeComponent()
txtEditable = New TextBox
' default
txtEditable.MaxLength = 30
txtEditable.Bounds = MyBase.Bounds
txtEditable.Visible = True
txtEditable.BringToFront()
' finally add the textbox control to the design
Me.Controls.Add(Me.txtEditable) ' errors on this line here
'MyBase.Controls.Add(MyBase.txtEditable) ' also if this is uncommented, it
throws the same error
End Sub
Protected Overrides Sub SetItemsCore(ByVal items As
System.Collections.IList)
MyBase.SetItemsCore(items)
End Sub
End Class
If any one could help me out that would be great..
Thanks heaps guys...
Kind Regards
--Nathan