Using custom controls with the form designer in VB

G

Guest

Hi guys,
I am using *VISUAL BASIC* in VS2005 beta 2.
I want to make a custom control that inherits the textbox control but has
some extra properties. This part is fairly simple I think (I have done it..
or at least i think i have).

The code looks something like this:

Public Class MyEditBox
Inherits System.Windows.Forms.TextBox
Private m_strDataFormat As String = ""

Public Property DataFormat() As String
Get
Return m_strDataFormat
End Get
Set(ByVal new_Value As String)
m_strDataFormat = new_Value
End Set
End Property

End Class

Is there a way I can add this to my toolbox for use at design time?
 
T

Tim Wilson

Is there a way I can add this to my toolbox for use at design time?
Yep. VB custom controls can be added to the ToolBox in VS 2005. The easiest
way to do this is to build the custom control in a separate control library
project. Then you add a smart device windows forms project to the same
solution, compile the custom control, and then look towards the top of the
ToolBox while designing the form within your win forms project. Your custom
control should be in the ToolBox and ready for you to drag onto the form. If
you make a change to the custom control just recompile it and the changes
should be picked up automatically.
 
G

Guest

Thanks

Tim Wilson said:
Yep. VB custom controls can be added to the ToolBox in VS 2005. The easiest
way to do this is to build the custom control in a separate control library
project. Then you add a smart device windows forms project to the same
solution, compile the custom control, and then look towards the top of the
ToolBox while designing the form within your win forms project. Your custom
control should be in the ToolBox and ready for you to drag onto the form. If
you make a change to the custom control just recompile it and the changes
should be picked up automatically.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top