Type 'TypeName' has no constructors

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Marina

    Type 'TypeName' has no constructors

    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


  • CJ Taylor

    #2
    Re: Type 'TypeName' has no constructors

    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" <someone@nospam .com> wrote in message
    news:uzqvoJbQEH A.3456@TK2MSFTN GP11.phx.gbl...[color=blue]
    > 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[/color]
    (generated[color=blue]
    > 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[/color]
    trying[color=blue]
    > 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[/color]
    everything[color=blue]
    > is great.
    >
    > Next time I need to recompile, I get this error again. In this case, I[/color]
    just[color=blue]
    > 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 -[/color]
    just[color=blue]
    > 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[/color]
    control[color=blue]
    > 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[/color]
    available[color=blue]
    > 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[/color]
    can[color=blue]
    > do about it?
    >
    > Thanks
    >
    >[/color]


    Comment

    • Marina

      #3
      Re: Type 'TypeName' has no constructors

      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:%239BtdPbQ EHA.3232@TK2MSF TNGP11.phx.gbl. ..[color=blue]
      > 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[/color]
      that[color=blue]
      > a constructor is avalible for it to use.
      >
      > Someone correct me if I'm wrong.
      >
      >
      > "Marina" <someone@nospam .com> wrote in message
      > news:uzqvoJbQEH A.3456@TK2MSFTN GP11.phx.gbl...[color=green]
      > > 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[/color]
      > (generated[color=green]
      > > 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[/color]
      > trying[color=green]
      > > out this user control), I get the error I put in the subject of this[/color][/color]
      post.[color=blue][color=green]
      > >
      > > Now, clearly, this class has a constructor.
      > > If I change the code by removing the word 'Public', and recompile[/color]
      > everything[color=green]
      > > is great.
      > >
      > > Next time I need to recompile, I get this error again. In this case, I[/color]
      > just[color=green]
      > > 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 -[/color]
      > just[color=green]
      > > 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[/color]
      > control[color=green]
      > > is compiled first.
      > >
      > > I've tried manually compiling the first project - and then the second.[/color][/color]
      And[color=blue][color=green]
      > > the second always fails, because it thinks there is no constructor[/color]
      > available[color=green]
      > > 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[/color]
      > can[color=green]
      > > do about it?
      > >
      > > Thanks
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Cor Ligthert

        #4
        Re: Type 'TypeName' has no constructors

        Hi Marina,

        I do not know this problem, however did you try it already with a new
        application and only the most needed things in it.

        Just an idea.

        Cor


        Comment

        • Cor Ligthert

          #5
          Re: Type 'TypeName' has no constructors

          Hi CJ,

          Marina is my fighting mate not a new one.

          Cor


          Comment

          • CJ Taylor

            #6
            Re: Type 'TypeName' has no constructors

            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" <someone@nospam .com> wrote in message
            news:%23l2qOUbQ EHA.2876@TK2MSF TNGP09.phx.gbl. ..[color=blue]
            > 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[/color]
            away[color=blue]
            > '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[/color]
            about[color=blue]
            > 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[/color]
            one.[color=blue]
            >
            > "CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message
            > news:%239BtdPbQ EHA.3232@TK2MSF TNGP11.phx.gbl. ..[color=green]
            > > If you don't put an accessor on there doesn't it default it to Friend?[/color][/color]
            In[color=blue][color=green]
            > > which case doesn't your project B (second compiled) need to be in the[/color][/color]
            same[color=blue][color=green]
            > > namespace in order for that to work?
            > >
            > > So therefore you contructor must be declared public or it doesn't think[/color]
            > that[color=green]
            > > a constructor is avalible for it to use.
            > >
            > > Someone correct me if I'm wrong.
            > >
            > >
            > > "Marina" <someone@nospam .com> wrote in message
            > > news:uzqvoJbQEH A.3456@TK2MSFTN GP11.phx.gbl...[color=darkred]
            > > > 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[/color]
            > > (generated[color=darkred]
            > > > 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[/color]
            > > trying[color=darkred]
            > > > out this user control), I get the error I put in the subject of this[/color][/color]
            > post.[color=green][color=darkred]
            > > >
            > > > Now, clearly, this class has a constructor.
            > > > If I change the code by removing the word 'Public', and recompile[/color]
            > > everything[color=darkred]
            > > > is great.
            > > >
            > > > Next time I need to recompile, I get this error again. In this case,[/color][/color][/color]
            I[color=blue][color=green]
            > > just[color=darkred]
            > > > 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 -[/color]
            > > just[color=darkred]
            > > > 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[/color]
            > > control[color=darkred]
            > > > is compiled first.
            > > >
            > > > I've tried manually compiling the first project - and then the second.[/color][/color]
            > And[color=green][color=darkred]
            > > > the second always fails, because it thinks there is no constructor[/color]
            > > available[color=darkred]
            > > > for the user control. Until that is, I take away or remove the[/color][/color][/color]
            'Public'[color=blue][color=green][color=darkred]
            > > > keyword off of the constructor - in which case its fine.
            > > >
            > > > Is this some ridiculous VB compiler problem? Some VS.NET bug. Anything[/color][/color][/color]
            I[color=blue][color=green]
            > > can[color=darkred]
            > > > do about it?
            > > >
            > > > Thanks
            > > >
            > > >[/color]
            > >
            > >[/color]
            >
            >[/color]


            Comment

            • Marina

              #7
              Re: Type 'TypeName' has no constructors

              There are only 2 projects. One of the projects has about a dozen classes -
              but not all are in this hierarchy I am talking about. The other is just the
              tester app.

              I will see if I can reproduce this with just a minimal # of files and code.

              I am having trouble believing that adding/removing a modifier keyword can
              have this effect, if not for the fact that I am the one having to add and
              remove it all the time....

              "CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message
              news:OJIjTkbQEH A.4052@TK2MSFTN GP10.phx.gbl...[color=blue]
              > 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" <someone@nospam .com> wrote in message
              > news:%23l2qOUbQ EHA.2876@TK2MSF TNGP09.phx.gbl. ..[color=green]
              > > 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[/color]
              > away[color=green]
              > > '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,[/color][/color]
              as[color=blue][color=green]
              > > then it definitely would not have had a constructor.
              > >
              > > So again, the question is, why is the compiler complaining constantly[/color]
              > about[color=green]
              > > 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[/color]
              > one.[color=green]
              > >
              > > "CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message
              > > news:%239BtdPbQ EHA.3232@TK2MSF TNGP11.phx.gbl. ..[color=darkred]
              > > > If you don't put an accessor on there doesn't it default it to Friend?[/color][/color]
              > In[color=green][color=darkred]
              > > > which case doesn't your project B (second compiled) need to be in the[/color][/color]
              > same[color=green][color=darkred]
              > > > namespace in order for that to work?
              > > >
              > > > So therefore you contructor must be declared public or it doesn't[/color][/color][/color]
              think[color=blue][color=green]
              > > that[color=darkred]
              > > > a constructor is avalible for it to use.
              > > >
              > > > Someone correct me if I'm wrong.
              > > >
              > > >
              > > > "Marina" <someone@nospam .com> wrote in message
              > > > news:uzqvoJbQEH A.3456@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[/color]
              > > post.[color=darkred]
              > > > >
              > > > > 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[/color][/color][/color]
              case,[color=blue]
              > I[color=green][color=darkred]
              > > > 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[/color][/color][/color]
              in -[color=blue][color=green][color=darkred]
              > > > 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[/color][/color][/color]
              second.[color=blue][color=green]
              > > And[color=darkred]
              > > > > 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[/color][/color]
              > 'Public'[color=green][color=darkred]
              > > > > keyword off of the constructor - in which case its fine.
              > > > >
              > > > > Is this some ridiculous VB compiler problem? Some VS.NET bug.[/color][/color][/color]
              Anything[color=blue]
              > I[color=green][color=darkred]
              > > > can
              > > > > do about it?
              > > > >
              > > > > Thanks
              > > > >
              > > > >
              > > >
              > > >[/color]
              > >
              > >[/color]
              >
              >[/color]


              Comment

              • Marina

                #8
                Re: Type 'TypeName' has no constructors

                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:OJIjTkbQEH A.4052@TK2MSFTN GP10.phx.gbl...[color=blue]
                > 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" <someone@nospam .com> wrote in message
                > news:%23l2qOUbQ EHA.2876@TK2MSF TNGP09.phx.gbl. ..[color=green]
                > > 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[/color]
                > away[color=green]
                > > '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,[/color][/color]
                as[color=blue][color=green]
                > > then it definitely would not have had a constructor.
                > >
                > > So again, the question is, why is the compiler complaining constantly[/color]
                > about[color=green]
                > > 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[/color]
                > one.[color=green]
                > >
                > > "CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message
                > > news:%239BtdPbQ EHA.3232@TK2MSF TNGP11.phx.gbl. ..[color=darkred]
                > > > If you don't put an accessor on there doesn't it default it to Friend?[/color][/color]
                > In[color=green][color=darkred]
                > > > which case doesn't your project B (second compiled) need to be in the[/color][/color]
                > same[color=green][color=darkred]
                > > > namespace in order for that to work?
                > > >
                > > > So therefore you contructor must be declared public or it doesn't[/color][/color][/color]
                think[color=blue][color=green]
                > > that[color=darkred]
                > > > a constructor is avalible for it to use.
                > > >
                > > > Someone correct me if I'm wrong.
                > > >
                > > >
                > > > "Marina" <someone@nospam .com> wrote in message
                > > > news:uzqvoJbQEH A.3456@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[/color]
                > > post.[color=darkred]
                > > > >
                > > > > 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[/color][/color][/color]
                case,[color=blue]
                > I[color=green][color=darkred]
                > > > 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[/color][/color][/color]
                in -[color=blue][color=green][color=darkred]
                > > > 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[/color][/color][/color]
                second.[color=blue][color=green]
                > > And[color=darkred]
                > > > > 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[/color][/color]
                > 'Public'[color=green][color=darkred]
                > > > > keyword off of the constructor - in which case its fine.
                > > > >
                > > > > Is this some ridiculous VB compiler problem? Some VS.NET bug.[/color][/color][/color]
                Anything[color=blue]
                > I[color=green][color=darkred]
                > > > can
                > > > > do about it?
                > > > >
                > > > > Thanks
                > > > >
                > > > >
                > > >
                > > >[/color]
                > >
                > >[/color]
                >
                >[/color]


                Comment

                • Jay B. Harlow [MVP - Outlook]

                  #9
                  Re: Type 'TypeName' has no constructors

                  Marina,
                  VS.NET 2002 or VS.NET 2003?

                  Are you referencing the Project or the generated DLL?

                  Does 'Build - Rebuild Solution' take care of the problem? (instead of
                  modifing the source file).

                  Hope this helps
                  Jay



                  "Marina" <someone@nospam .com> wrote in message
                  news:%23tjQbvbQ EHA.3476@tk2msf tngp13.phx.gbl. ..[color=blue]
                  > Ok, here is the reproduceable code (at least over here). The controls are[/color]
                  in[color=blue]
                  > 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[/color]
                  InitializeCompo nent()[color=blue]
                  > 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[/color]
                  InitializeCompo nent()[color=blue]
                  > '
                  > '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[/color]
                  InitializeCompo nent()[color=blue]
                  > 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:OJIjTkbQEH A.4052@TK2MSFTN GP10.phx.gbl...[color=green]
                  > > 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[/color][/color]
                  pulling[color=blue][color=green]
                  > > straws right now I hope you know.. just trying to help.
                  > >
                  > > -CJ
                  > >
                  > > "Marina" <someone@nospam .com> wrote in message
                  > > news:%23l2qOUbQ EHA.2876@TK2MSF TNGP09.phx.gbl. ..[color=darkred]
                  > > > I don't think you carefully read my post, but just skimmed for some[/color][/color][/color]
                  key[color=blue][color=green][color=darkred]
                  > > > words.
                  > > >
                  > > > The constructor was declared public. And that caused an error. Taking[/color]
                  > > away[color=darkred]
                  > > > 'Public' would then compile fine.
                  > > >
                  > > > Next time I made a change, it woudln't compile again. So I would put[/color][/color][/color]
                  the[color=blue][color=green][color=darkred]
                  > > > 'Public' back in. Then it was fine again.
                  > > >
                  > > > The point being, that I kept needing to add and remove the word[/color][/color][/color]
                  'Public'[color=blue][color=green][color=darkred]
                  > > > every other change in order to get the project to compile.
                  > > >
                  > > > In fact, I believe that the default for a constructor is 'Public',[/color][/color][/color]
                  else[color=blue][color=green][color=darkred]
                  > > > taking 'Public' away, would never have compiled the tester[/color][/color][/color]
                  application,[color=blue]
                  > as[color=green][color=darkred]
                  > > > then it definitely would not have had a constructor.
                  > > >
                  > > > So again, the question is, why is the compiler complaining constantly[/color]
                  > > about[color=darkred]
                  > > > not finding a constructor, making me place and remove the word[/color][/color][/color]
                  'Public'[color=blue][color=green][color=darkred]
                  > > > every other compile time, in order to make it work?
                  > > >
                  > > > Note: There may be other ways that work in getting the compiler to[/color][/color][/color]
                  work[color=blue][color=green][color=darkred]
                  > > > other then this trick with 'Public', I don't know. I just found an[/color][/color][/color]
                  easy[color=blue][color=green]
                  > > one.[color=darkred]
                  > > >
                  > > > "CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message
                  > > > news:%239BtdPbQ EHA.3232@TK2MSF TNGP11.phx.gbl. ..
                  > > > > If you don't put an accessor on there doesn't it default it to[/color][/color][/color]
                  Friend?[color=blue][color=green]
                  > > In[color=darkred]
                  > > > > which case doesn't your project B (second compiled) need to be in[/color][/color][/color]
                  the[color=blue][color=green]
                  > > same[color=darkred]
                  > > > > namespace in order for that to work?
                  > > > >
                  > > > > So therefore you contructor must be declared public or it doesn't[/color][/color]
                  > think[color=green][color=darkred]
                  > > > that
                  > > > > a constructor is avalible for it to use.
                  > > > >
                  > > > > Someone correct me if I'm wrong.
                  > > > >
                  > > > >
                  > > > > "Marina" <someone@nospam .com> wrote in message
                  > > > > news:uzqvoJbQEH A.3456@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[/color][/color][/color]
                  for[color=blue][color=green][color=darkred]
                  > > > > > 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()[/color][/color][/color]
                  call[color=blue][color=green][color=darkred]
                  > > > > >
                  > > > > > End Sub
                  > > > > >
                  > > > > > Sometimes (about half the time), when I recompile my solution[/color][/color][/color]
                  (which[color=blue][color=green][color=darkred]
                  > > > > > contains a project with this class, and a project with a form[/color][/color][/color]
                  tester[color=blue][color=green][color=darkred]
                  > > > > trying
                  > > > > > out this user control), I get the error I put in the subject of[/color][/color][/color]
                  this[color=blue][color=green][color=darkred]
                  > > > 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[/color][/color]
                  > case,[color=green]
                  > > I[color=darkred]
                  > > > > 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[/color][/color]
                  > in -[color=green][color=darkred]
                  > > > > 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[/color][/color][/color]
                  user[color=blue][color=green][color=darkred]
                  > > > > control
                  > > > > > is compiled first.
                  > > > > >
                  > > > > > I've tried manually compiling the first project - and then the[/color][/color]
                  > second.[color=green][color=darkred]
                  > > > 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[/color]
                  > > 'Public'[color=darkred]
                  > > > > > keyword off of the constructor - in which case its fine.
                  > > > > >
                  > > > > > Is this some ridiculous VB compiler problem? Some VS.NET bug.[/color][/color]
                  > Anything[color=green]
                  > > I[color=darkred]
                  > > > > can
                  > > > > > do about it?
                  > > > > >
                  > > > > > Thanks
                  > > > > >
                  > > > > >
                  > > > >
                  > > > >
                  > > >
                  > > >[/color]
                  > >
                  > >[/color]
                  >
                  >[/color]


                  Comment

                  • Cor Ligthert

                    #10
                    Re: Type 'TypeName' has no constructors

                    Hi Marina,

                    I can not reproduce it, can you tell me what I have to add to the method?

                    After you answered the question from Jay of course.

                    However you will see my next answer not for tomorrow probably, so do not
                    count to much on that.

                    Cor


                    Comment

                    • Marina

                      #11
                      Re: Type 'TypeName' has no constructors

                      Well, just try adding a new method to BaseInputContro l that is protected -
                      doing that usually does the trick for me.

                      "Cor Ligthert" <notfirstname@p lanet.nl> wrote in message
                      news:eslciTcQEH A.2936@TK2MSFTN GP12.phx.gbl...[color=blue]
                      > Hi Marina,
                      >
                      > I can not reproduce it, can you tell me what I have to add to the method?
                      >
                      > After you answered the question from Jay of course.
                      >
                      > However you will see my next answer not for tomorrow probably, so do not
                      > count to much on that.
                      >
                      > Cor
                      >
                      >[/color]


                      Comment

                      • Marina

                        #12
                        Re: Type 'TypeName' has no constructors

                        As you can see in my response to Jay, rebuilding the solution helps. I am
                        still mystified as to why this happens at all, and why this particular error
                        in this particular case.

                        In any case, thanks for taking an interest and trying to help.

                        "Cor Ligthert" <notfirstname@p lanet.nl> wrote in message
                        news:eslciTcQEH A.2936@TK2MSFTN GP12.phx.gbl...[color=blue]
                        > Hi Marina,
                        >
                        > I can not reproduce it, can you tell me what I have to add to the method?
                        >
                        > After you answered the question from Jay of course.
                        >
                        > However you will see my next answer not for tomorrow probably, so do not
                        > count to much on that.
                        >
                        > Cor
                        >
                        >[/color]


                        Comment

                        • Marina

                          #13
                          Re: Type 'TypeName' has no constructors

                          This is VS.NET 2003.

                          I am referencing the generated DLL.

                          Oddly enough - chosing rebuild solution does work.

                          I've gotten used to doing just a build (ctl + shift + b), and I've doing
                          that for probably 3 years and haven't had a problem yet. I guess I'll have
                          to reassign that to the rebuild command...

                          Do you have any idea why rebuilding the solution helps?

                          Or better yet, why does this happen at all?

                          Thanks

                          "Jay B. Harlow [MVP - Outlook]" <Jay_Harlow_MVP @msn.com> wrote in message
                          news:%23Fw%23yN cQEHA.624@TK2MS FTNGP11.phx.gbl ...[color=blue]
                          > Marina,
                          > VS.NET 2002 or VS.NET 2003?
                          >
                          > Are you referencing the Project or the generated DLL?
                          >
                          > Does 'Build - Rebuild Solution' take care of the problem? (instead of
                          > modifing the source file).
                          >
                          > Hope this helps
                          > Jay
                          >
                          >
                          >
                          > "Marina" <someone@nospam .com> wrote in message
                          > news:%23tjQbvbQ EHA.3476@tk2msf tngp13.phx.gbl. ..[color=green]
                          > > Ok, here is the reproduceable code (at least over here). The controls[/color][/color]
                          are[color=blue]
                          > in[color=green]
                          > > 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[/color][/color]
                          a[color=blue][color=green]
                          > > Protected method to BaseInputContro l.vb), that will trigger this. Not[/color][/color]
                          all[color=blue][color=green]
                          > > changes cause this behavior - so it doesn't happen with every change -[/color][/color]
                          but[color=blue][color=green]
                          > > 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[/color]
                          > InitializeCompo nent()[color=green]
                          > > 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[/color]
                          > InitializeCompo nent()[color=green]
                          > > '
                          > > '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[/color]
                          > InitializeCompo nent()[color=green]
                          > > 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:OJIjTkbQEH A.4052@TK2MSFTN GP10.phx.gbl...[color=darkred]
                          > > > My apologies. I did misread the post.
                          > > >
                          > > > Wow...
                          > > >
                          > > > Wierd question, but how many projects are in your solution... I ran[/color][/color][/color]
                          into[color=blue][color=green][color=darkred]
                          > > > some weird compiler errors when I had a lot of projects. I'm just[/color][/color]
                          > pulling[color=green][color=darkred]
                          > > > straws right now I hope you know.. just trying to help.
                          > > >
                          > > > -CJ
                          > > >
                          > > > "Marina" <someone@nospam .com> wrote in message
                          > > > news:%23l2qOUbQ EHA.2876@TK2MSF TNGP09.phx.gbl. ..
                          > > > > I don't think you carefully read my post, but just skimmed for some[/color][/color]
                          > key[color=green][color=darkred]
                          > > > > words.
                          > > > >
                          > > > > The constructor was declared public. And that caused an error.[/color][/color][/color]
                          Taking[color=blue][color=green][color=darkred]
                          > > > away
                          > > > > 'Public' would then compile fine.
                          > > > >
                          > > > > Next time I made a change, it woudln't compile again. So I would put[/color][/color]
                          > the[color=green][color=darkred]
                          > > > > 'Public' back in. Then it was fine again.
                          > > > >
                          > > > > The point being, that I kept needing to add and remove the word[/color][/color]
                          > 'Public'[color=green][color=darkred]
                          > > > > every other change in order to get the project to compile.
                          > > > >
                          > > > > In fact, I believe that the default for a constructor is 'Public',[/color][/color]
                          > else[color=green][color=darkred]
                          > > > > taking 'Public' away, would never have compiled the tester[/color][/color]
                          > application,[color=green]
                          > > as[color=darkred]
                          > > > > then it definitely would not have had a constructor.
                          > > > >
                          > > > > So again, the question is, why is the compiler complaining[/color][/color][/color]
                          constantly[color=blue][color=green][color=darkred]
                          > > > about
                          > > > > not finding a constructor, making me place and remove the word[/color][/color]
                          > 'Public'[color=green][color=darkred]
                          > > > > every other compile time, in order to make it work?
                          > > > >
                          > > > > Note: There may be other ways that work in getting the compiler to[/color][/color]
                          > work[color=green][color=darkred]
                          > > > > other then this trick with 'Public', I don't know. I just found an[/color][/color]
                          > easy[color=green][color=darkred]
                          > > > one.
                          > > > >
                          > > > > "CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message
                          > > > > news:%239BtdPbQ EHA.3232@TK2MSF TNGP11.phx.gbl. ..
                          > > > > > If you don't put an accessor on there doesn't it default it to[/color][/color]
                          > Friend?[color=green][color=darkred]
                          > > > In
                          > > > > > which case doesn't your project B (second compiled) need to be in[/color][/color]
                          > the[color=green][color=darkred]
                          > > > same
                          > > > > > namespace in order for that to work?
                          > > > > >
                          > > > > > So therefore you contructor must be declared public or it doesn't[/color]
                          > > think[color=darkred]
                          > > > > that
                          > > > > > a constructor is avalible for it to use.
                          > > > > >
                          > > > > > Someone correct me if I'm wrong.
                          > > > > >
                          > > > > >
                          > > > > > "Marina" <someone@nospam .com> wrote in message
                          > > > > > news:uzqvoJbQEH A.3456@TK2MSFTN GP11.phx.gbl...
                          > > > > > > Hi, if anyone can help on this, please! This is driving me[/color][/color][/color]
                          crazy.[color=blue][color=green][color=darkred]
                          > > > > > >
                          > > > > > > I have a user control hierarchy several levels deep that derive[/color][/color]
                          > for[color=green][color=darkred]
                          > > > > > > UserControl (windows).
                          > > > > > >
                          > > > > > > The class that is at the top level, has the following[/color][/color][/color]
                          constructor[color=blue][color=green][color=darkred]
                          > > > > > (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()[/color][/color]
                          > call[color=green][color=darkred]
                          > > > > > >
                          > > > > > > End Sub
                          > > > > > >
                          > > > > > > Sometimes (about half the time), when I recompile my solution[/color][/color]
                          > (which[color=green][color=darkred]
                          > > > > > > contains a project with this class, and a project with a form[/color][/color]
                          > tester[color=green][color=darkred]
                          > > > > > trying
                          > > > > > > out this user control), I get the error I put in the subject of[/color][/color]
                          > this[color=green][color=darkred]
                          > > > > post.
                          > > > > > >
                          > > > > > > Now, clearly, this class has a constructor.
                          > > > > > > If I change the code by removing the word 'Public', and[/color][/color][/color]
                          recompile[color=blue][color=green][color=darkred]
                          > > > > > everything
                          > > > > > > is great.
                          > > > > > >
                          > > > > > > Next time I need to recompile, I get this error again. In this[/color]
                          > > case,[color=darkred]
                          > > > I
                          > > > > > just
                          > > > > > > put the word 'Public' back in, and recompile - all is well[/color][/color][/color]
                          again.[color=blue][color=green][color=darkred]
                          > > > > > >
                          > > > > > > So I spend half my time removing 'Public' and then adding it[/color][/color][/color]
                          back[color=blue][color=green]
                          > > in -[color=darkred]
                          > > > > > just
                          > > > > > > to get the compiler to change its mind.
                          > > > > > >
                          > > > > > > Now, it doesn't do this all the time. Sometimes it recompiles[/color][/color][/color]
                          OK.[color=blue][color=green][color=darkred]
                          > > > > > >
                          > > > > > > I've checked the project build order - and the project with the[/color][/color]
                          > user[color=green][color=darkred]
                          > > > > > control
                          > > > > > > is compiled first.
                          > > > > > >
                          > > > > > > I've tried manually compiling the first project - and then the[/color]
                          > > second.[color=darkred]
                          > > > > And
                          > > > > > > the second always fails, because it thinks there is no[/color][/color][/color]
                          constructor[color=blue][color=green][color=darkred]
                          > > > > > 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.[/color]
                          > > Anything[color=darkred]
                          > > > I
                          > > > > > can
                          > > > > > > do about it?
                          > > > > > >
                          > > > > > > Thanks
                          > > > > > >
                          > > > > > >
                          > > > > >
                          > > > > >
                          > > > >
                          > > > >
                          > > >
                          > > >[/color]
                          > >
                          > >[/color]
                          >
                          >[/color]


                          Comment

                          • Armin Zingler

                            #14
                            Re: Type 'TypeName' has no constructors

                            "Marina" <someone@nospam .com> schrieb[color=blue]
                            > Well, just try adding a new method to BaseInputContro l that is
                            > protected - doing that usually does the trick for me.[/color]

                            When I do it, I get an error in BaseInputContro l:

                            "TestControlLib rary.BaseInputC ontrol.Private Sub InitializeCompo nent()" is
                            not accesible in this context because it is "private".

                            I think the error is not ok. When I rebuild, the error disappears.


                            --
                            Armin

                            How to quote and why:



                            Comment

                            • Jay B. Harlow [MVP - Outlook]

                              #15
                              Re: Type 'TypeName' has no constructors

                              Marina,
                              I normally reference the project itself, not the DLL. My understanding is
                              referencing the project enables VS.NET to better determine dependencies.
                              [color=blue]
                              > Or better yet, why does this happen at all?[/color]
                              I believe it happens because the background compilation gets confused.



                              [color=blue]
                              > Do you have any idea why rebuilding the solution helps?[/color]
                              My theory is the background compilation gets confused, and the Build Rebuild
                              Solution throws every thing out & does a 100% clean compile, however that is
                              just my theory.

                              I know VS.NET 2002 had more problems with then VS.NET 2003 does, at least on
                              the multi-project solutions that I have worked on.

                              Hope this helps
                              Jay


                              "Marina" <someone@nospam .com> wrote in message
                              news:%23nQsQfcQ EHA.4052@TK2MSF TNGP10.phx.gbl. ..[color=blue]
                              > This is VS.NET 2003.
                              >
                              > I am referencing the generated DLL.
                              >
                              > Oddly enough - chosing rebuild solution does work.
                              >
                              > I've gotten used to doing just a build (ctl + shift + b), and I've doing
                              > that for probably 3 years and haven't had a problem yet. I guess I'll have
                              > to reassign that to the rebuild command...
                              >
                              > Do you have any idea why rebuilding the solution helps?
                              >
                              > Or better yet, why does this happen at all?
                              >
                              > Thanks
                              >
                              > "Jay B. Harlow [MVP - Outlook]" <Jay_Harlow_MVP @msn.com> wrote in message
                              > news:%23Fw%23yN cQEHA.624@TK2MS FTNGP11.phx.gbl ...[color=green]
                              > > Marina,
                              > > VS.NET 2002 or VS.NET 2003?
                              > >
                              > > Are you referencing the Project or the generated DLL?
                              > >
                              > > Does 'Build - Rebuild Solution' take care of the problem? (instead of
                              > > modifing the source file).
                              > >
                              > > Hope this helps
                              > > Jay
                              > >
                              > >
                              > >
                              > > "Marina" <someone@nospam .com> wrote in message
                              > > news:%23tjQbvbQ EHA.3476@tk2msf tngp13.phx.gbl. ..[color=darkred]
                              > > > Ok, here is the reproduceable code (at least over here). The controls[/color][/color]
                              > are[color=green]
                              > > in[color=darkred]
                              > > > 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[/color][/color][/color]
                              adding[color=blue]
                              > a[color=green][color=darkred]
                              > > > Protected method to BaseInputContro l.vb), that will trigger this. Not[/color][/color]
                              > all[color=green][color=darkred]
                              > > > changes cause this behavior - so it doesn't happen with every change -[/color][/color]
                              > but[color=green][color=darkred]
                              > > > 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[/color][/color][/color]
                              Designer[color=blue][color=green][color=darkred]
                              > > > '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[/color]
                              > > InitializeCompo nent()[color=darkred]
                              > > > 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[/color][/color][/color]
                              Designer[color=blue][color=green][color=darkred]
                              > > > 'It can be modified using the Windows Form Designer.
                              > > > 'Do not modify it using the code editor.
                              > > > <System.Diagnos tics.DebuggerSt epThrough()> Private Sub[/color]
                              > > InitializeCompo nent()[color=darkred]
                              > > > '
                              > > > '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[/color][/color][/color]
                              Designer[color=blue][color=green][color=darkred]
                              > > > '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[/color]
                              > > InitializeCompo nent()[color=darkred]
                              > > > 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:OJIjTkbQEH A.4052@TK2MSFTN GP10.phx.gbl...
                              > > > > My apologies. I did misread the post.
                              > > > >
                              > > > > Wow...
                              > > > >
                              > > > > Wierd question, but how many projects are in your solution... I ran[/color][/color]
                              > into[color=green][color=darkred]
                              > > > > some weird compiler errors when I had a lot of projects. I'm just[/color]
                              > > pulling[color=darkred]
                              > > > > straws right now I hope you know.. just trying to help.
                              > > > >
                              > > > > -CJ
                              > > > >
                              > > > > "Marina" <someone@nospam .com> wrote in message
                              > > > > news:%23l2qOUbQ EHA.2876@TK2MSF TNGP09.phx.gbl. ..
                              > > > > > I don't think you carefully read my post, but just skimmed for[/color][/color][/color]
                              some[color=blue][color=green]
                              > > key[color=darkred]
                              > > > > > words.
                              > > > > >
                              > > > > > The constructor was declared public. And that caused an error.[/color][/color]
                              > Taking[color=green][color=darkred]
                              > > > > away
                              > > > > > 'Public' would then compile fine.
                              > > > > >
                              > > > > > Next time I made a change, it woudln't compile again. So I would[/color][/color][/color]
                              put[color=blue][color=green]
                              > > the[color=darkred]
                              > > > > > 'Public' back in. Then it was fine again.
                              > > > > >
                              > > > > > The point being, that I kept needing to add and remove the word[/color]
                              > > 'Public'[color=darkred]
                              > > > > > every other change in order to get the project to compile.
                              > > > > >
                              > > > > > In fact, I believe that the default for a constructor is 'Public',[/color]
                              > > else[color=darkred]
                              > > > > > taking 'Public' away, would never have compiled the tester[/color]
                              > > application,[color=darkred]
                              > > > as
                              > > > > > then it definitely would not have had a constructor.
                              > > > > >
                              > > > > > So again, the question is, why is the compiler complaining[/color][/color]
                              > constantly[color=green][color=darkred]
                              > > > > about
                              > > > > > not finding a constructor, making me place and remove the word[/color]
                              > > 'Public'[color=darkred]
                              > > > > > every other compile time, in order to make it work?
                              > > > > >
                              > > > > > Note: There may be other ways that work in getting the compiler to[/color]
                              > > work[color=darkred]
                              > > > > > other then this trick with 'Public', I don't know. I just found an[/color]
                              > > easy[color=darkred]
                              > > > > one.
                              > > > > >
                              > > > > > "CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message
                              > > > > > news:%239BtdPbQ EHA.3232@TK2MSF TNGP11.phx.gbl. ..
                              > > > > > > If you don't put an accessor on there doesn't it default it to[/color]
                              > > Friend?[color=darkred]
                              > > > > In
                              > > > > > > which case doesn't your project B (second compiled) need to be[/color][/color][/color]
                              in[color=blue][color=green]
                              > > the[color=darkred]
                              > > > > same
                              > > > > > > namespace in order for that to work?
                              > > > > > >
                              > > > > > > So therefore you contructor must be declared public or it[/color][/color][/color]
                              doesn't[color=blue][color=green][color=darkred]
                              > > > think
                              > > > > > that
                              > > > > > > a constructor is avalible for it to use.
                              > > > > > >
                              > > > > > > Someone correct me if I'm wrong.
                              > > > > > >
                              > > > > > >
                              > > > > > > "Marina" <someone@nospam .com> wrote in message
                              > > > > > > news:uzqvoJbQEH A.3456@TK2MSFTN GP11.phx.gbl...
                              > > > > > > > Hi, if anyone can help on this, please! This is driving me[/color][/color]
                              > crazy.[color=green][color=darkred]
                              > > > > > > >
                              > > > > > > > I have a user control hierarchy several levels deep that[/color][/color][/color]
                              derive[color=blue][color=green]
                              > > for[color=darkred]
                              > > > > > > > UserControl (windows).
                              > > > > > > >
                              > > > > > > > The class that is at the top level, has the following[/color][/color]
                              > constructor[color=green][color=darkred]
                              > > > > > > (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[/color][/color][/color]
                              InitializeCompo nent()[color=blue][color=green]
                              > > call[color=darkred]
                              > > > > > > >
                              > > > > > > > End Sub
                              > > > > > > >
                              > > > > > > > Sometimes (about half the time), when I recompile my solution[/color]
                              > > (which[color=darkred]
                              > > > > > > > contains a project with this class, and a project with a form[/color]
                              > > tester[color=darkred]
                              > > > > > > trying
                              > > > > > > > out this user control), I get the error I put in the subject[/color][/color][/color]
                              of[color=blue][color=green]
                              > > this[color=darkred]
                              > > > > > post.
                              > > > > > > >
                              > > > > > > > Now, clearly, this class has a constructor.
                              > > > > > > > If I change the code by removing the word 'Public', and[/color][/color]
                              > recompile[color=green][color=darkred]
                              > > > > > > everything
                              > > > > > > > is great.
                              > > > > > > >
                              > > > > > > > Next time I need to recompile, I get this error again. In[/color][/color][/color]
                              this[color=blue][color=green][color=darkred]
                              > > > case,
                              > > > > I
                              > > > > > > just
                              > > > > > > > put the word 'Public' back in, and recompile - all is well[/color][/color]
                              > again.[color=green][color=darkred]
                              > > > > > > >
                              > > > > > > > So I spend half my time removing 'Public' and then adding it[/color][/color]
                              > back[color=green][color=darkred]
                              > > > in -
                              > > > > > > just
                              > > > > > > > to get the compiler to change its mind.
                              > > > > > > >
                              > > > > > > > Now, it doesn't do this all the time. Sometimes it recompiles[/color][/color]
                              > OK.[color=green][color=darkred]
                              > > > > > > >
                              > > > > > > > I've checked the project build order - and the project with[/color][/color][/color]
                              the[color=blue][color=green]
                              > > user[color=darkred]
                              > > > > > > 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[/color][/color]
                              > constructor[color=green][color=darkred]
                              > > > > > > available
                              > > > > > > > for the user control. Until that is, I take away or remove[/color][/color][/color]
                              the[color=blue][color=green][color=darkred]
                              > > > > '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
                              > > > > > > >
                              > > > > > > >
                              > > > > > >
                              > > > > > >
                              > > > > >
                              > > > > >
                              > > > >
                              > > > >
                              > > >
                              > > >[/color]
                              > >
                              > >[/color]
                              >
                              >[/color]


                              Comment

                              Working...