design usertextbox

  • Thread starter Thread starter Frank
  • Start date Start date
F

Frank

Hello,
I made a library for classA which inherits from textbox. If I dim and
controls.add that in an application it works as expected. But I would like
to see my textbox in designmode. How do I go about that?
Just customizing the vb.net toolbox with the dll gives the error 'not
recognized as COM server'.
I use the standard VB installation (I made the dll by replacing 'winexe' in
the vbproj file by 'library').
Thanks for your help
Frank
 
* "Frank said:
I made a library for classA which inherits from textbox. If I dim and
controls.add that in an application it works as expected. But I would like
to see my textbox in designmode. How do I go about that?
Just customizing the vb.net toolbox with the dll gives the error 'not
recognized as COM server'.
I use the standard VB installation (I made the dll by replacing 'winexe' in
the vbproj file by 'library').

Did you add the class library project to your solution? Are you sure
the project references are set (see context menu of the projects in
solution explorer)?
 
Take a look at:
http://www.fawcette.com/vsm/2004_03/magazine/columns/gettingstarted/

Not sure what you are saying you tried, but don't editing your .vbproj file
in a text editor. Just create a new Class Library project. Add references
to System.Windows.Forms and System.Drawing.

Here is some code from a simple custom Label control I made. It adds to my
toolbox without error.

HTH,
Greg


Imports System.Windows.Forms

<System.Drawing.ToolboxBitmap(GetType(System.Windows.Forms.Label))> _
Public Class DisplayBox
Inherits System.Windows.Forms.Label

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call
'UseMnemonic = False
End Sub

'UserControl1 overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
components = New System.ComponentModel.Container
End Sub

#End Region

Private m_ForeColor As System.Drawing.Color = System.Drawing.Color.Blue
Private m_BackColor As System.Drawing.Color =
System.Drawing.SystemColors.Window
Private m_BorderStyle As BorderStyle = BorderStyle.FixedSingle

<System.ComponentModel.DefaultValue(GetType(System.Drawing.Color),
"Blue")> _
Public Overrides Property ForeColor() As System.Drawing.Color
Get
Return m_ForeColor
End Get
Set(ByVal Value As System.Drawing.Color)
m_ForeColor = Value
End Set
End Property

<System.ComponentModel.DefaultValue(GetType(System.Drawing.Color),
"Window")> _
Public Overrides Property BackColor() As System.Drawing.Color
Get
Return m_BackColor
End Get
Set(ByVal Value As System.Drawing.Color)
m_BackColor = Value
End Set
End Property


<System.ComponentModel.DefaultValue(GetType(System.Windows.Forms.BorderStyle
), "FixedSingle")> _
Public Overrides Property BorderStyle() As
System.Windows.Forms.BorderStyle
Get
Return m_BorderStyle
End Get
Set(ByVal Value As System.Windows.Forms.BorderStyle)
m_BorderStyle = Value
End Set
End Property

End Class
 
Greg, as I said I have the standard VB version so I cannot create a library
project. VB standard does not have that choice.
Frank
 
Herfried K. Wagner said:
Did you add the class library project to your solution? Are you sure
the project references are set (see context menu of the projects in
solution explorer)?

Herfried,
I get the impression from your answer that I am on the right track.
But do u have 2 questions or is it the same question asked twice?
In sol explorer/references I see my DLL. Should I also put it at another
place? More precisely: is adding my library to the solution something else
then setting it in the project references?
Thanks
Frank
 
Oh, sorry I misunderstood. I took you literally, which of course is not the
"standard" way to "install" a dll. Unless, it appears, you are running VB
Standard Edition. :^)
 
Back
Top