Ok, here is the reproduceable code (at least over here). The controls are in
one project, Form1.vb is in a separate project (one solution).
The key is, there has to be a change in the controls dll (such as adding a
Protected method to BaseInputContro l.vb), that will trigger this. Not all
changes cause this behavior - so it doesn't happen with every change - but
very frequently.
BaseInputContro l.vb:
Imports System.Componen tModel
Imports System.Componen tModel.Design
Imports System.Drawing. Design
Public Class BaseInputContro l
Inherits UserControl
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeCompo nent()
'Add any initialization after the InitializeCompo nent() call
End Sub
'Form 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.Disp ose()
End If
End If
MyBase.Dispose( disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.Componen tModel.IContain er
'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.
Protected WithEvents inputCtl As System.Windows. Forms.TextBox
<System.Diagnos tics.DebuggerSt epThrough()> Private Sub InitializeCompo nent()
Me.inputCtl = New System.Windows. Forms.TextBox
Me.SuspendLayou t()
'
'inputCtl
'
Me.inputCtl.Loc ation = New System.Drawing. Point(0, 0)
Me.inputCtl.Nam e = "inputCtl"
Me.inputCtl.Siz e = New System.Drawing. Size(89, 20)
Me.inputCtl.Tab Index = 0
Me.inputCtl.Tex t = ""
'
'BaseInputContr ol
'
Me.Controls.Add (Me.inputCtl)
Me.Name = "BaseInputContr ol"
Me.Size = New System.Drawing. Size(89, 20)
Me.ResumeLayout (False)
End Sub
#End Region
Private s As String
Protected Sub AdjustBackgroun dColor()
End Sub
End Class
BaseFormInputCo ntrol.vb:
Imports System.Componen tModel
Imports System.Componen tModel.Design
Imports System.Drawing. Design
Public Class BaseFormInputCo ntrol
Inherits BaseInputContro l
#Region " Windows Form Designer generated code "
'UserControl 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.Disp ose()
End If
End If
MyBase.Dispose( disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.Componen tModel.IContain er
'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.Diagnos tics.DebuggerSt epThrough()> Private Sub InitializeCompo nent()
'
'inputCtl
'
Me.inputCtl.Acc eptsReturn = True
Me.inputCtl.Nam e = "inputCtl"
'
'BaseFormInputC ontrol
'
Me.Name = "BaseFormInputC ontrol"
End Sub
#End Region
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeCompo nent()
'Add any initialization after the InitializeCompo nent() call
End Sub
Public Sub test()
End Sub
Private Sub inputCtl_Valida ting(ByVal sender As Object, ByVal e As
System.EventArg s) Handles inputCtl.Valida ted
AdjustBackgroun dColor()
End Sub
End Class
Form1.vb:
Public Class Form1
Inherits System.Windows. Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeCompo nent()
'Add any initialization after the InitializeCompo nent() call
End Sub
'Form 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.Disp ose()
End If
End If
MyBase.Dispose( disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.Componen tModel.IContain er
'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.
Friend WithEvents BaseFormInputCo ntrol1 As
TestControlLibr ary.BaseFormInp utControl
<System.Diagnos tics.DebuggerSt epThrough()> Private Sub InitializeCompo nent()
Me.BaseFormInpu tControl1 = New TestControlLibr ary.BaseFormInp utControl
Me.SuspendLayou t()
'
'BaseFormInputC ontrol1
'
Me.BaseFormInpu tControl1.Locat ion = New System.Drawing. Point(192, 80)
Me.BaseFormInpu tControl1.Name = "BaseFormInputC ontrol1"
Me.BaseFormInpu tControl1.Size = New System.Drawing. Size(89, 20)
Me.BaseFormInpu tControl1.TabIn dex = 0
'
'Form1
'
Me.AutoScaleBas eSize = New System.Drawing. Size(5, 13)
Me.ClientSize = New System.Drawing. Size(448, 266)
Me.Controls.Add (Me.BaseFormInp utControl1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout (False)
End Sub
#End Region
End Class
"CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message
news:OJ******** ******@TK2MSFTN GP10.phx.gbl...
My apologies. I did misread the post.
Wow...
Wierd question, but how many projects are in your solution... I ran into
some weird compiler errors when I had a lot of projects. I'm just pulling
straws right now I hope you know.. just trying to help.
-CJ
"Marina" <so*****@nospam .com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. .. I don't think you carefully read my post, but just skimmed for some key
words.
The constructor was declared public. And that caused an error. Taking away 'Public' would then compile fine.
Next time I made a change, it woudln't compile again. So I would put the
'Public' back in. Then it was fine again.
The point being, that I kept needing to add and remove the word 'Public'
every other change in order to get the project to compile.
In fact, I believe that the default for a constructor is 'Public', else
taking 'Public' away, would never have compiled the tester application,
as then it definitely would not have had a constructor.
So again, the question is, why is the compiler complaining constantly
about not finding a constructor, making me place and remove the word 'Public'
every other compile time, in order to make it work?
Note: There may be other ways that work in getting the compiler to work
other then this trick with 'Public', I don't know. I just found an easy
one.
"CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. .. If you don't put an accessor on there doesn't it default it to Friend? In which case doesn't your project B (second compiled) need to be in the same namespace in order for that to work?
So therefore you contructor must be declared public or it doesn't
think that a constructor is avalible for it to use.
Someone correct me if I'm wrong.
"Marina" <so*****@nospam .com> wrote in message
news:uz******** ******@TK2MSFTN GP11.phx.gbl...
> Hi, if anyone can help on this, please! This is driving me crazy.
>
> I have a user control hierarchy several levels deep that derive for
> UserControl (windows).
>
> The class that is at the top level, has the following constructor
(generated
> by VS.NET)
> Public Sub New()
> MyBase.New()
>
> 'This call is required by the Windows Form Designer.
> InitializeCompo nent()
> 'Add any initialization after the InitializeCompo nent() call
>
> End Sub
>
> Sometimes (about half the time), when I recompile my solution (which
> contains a project with this class, and a project with a form tester
trying
> out this user control), I get the error I put in the subject of this
post. >
> Now, clearly, this class has a constructor.
> If I change the code by removing the word 'Public', and recompile
everything
> is great.
>
> Next time I need to recompile, I get this error again. In this
case, I just
> put the word 'Public' back in, and recompile - all is well again.
>
> So I spend half my time removing 'Public' and then adding it back
in - just
> to get the compiler to change its mind.
>
> Now, it doesn't do this all the time. Sometimes it recompiles OK.
>
> I've checked the project build order - and the project with the user
control
> is compiled first.
>
> I've tried manually compiling the first project - and then the
second. And > the second always fails, because it thinks there is no constructor
available
> for the user control. Until that is, I take away or remove the
'Public' > keyword off of the constructor - in which case its fine.
>
> Is this some ridiculous VB compiler problem? Some VS.NET bug.
Anything I can
> do about it?
>
> Thanks
>
>