Weird UserControl behavior

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

    Weird UserControl behavior

    My apologies if this has been discussed before, but using Google and
    also searching the newsgroup has not given me any insight to this problem.

    I'm experiencing some strange behavior when I copy and paste a
    usercontrol. What happens is that the controls inside the usercontrol
    are being created on the form in addition to the copy of the usercontrol.

    I'm using VS 2008 Pro, v9.0.21022.8 with .NET 3.5.

    Here's how I can duplicate the problem:
    1) Create a new Windows Application project.
    2) Add a User Control class to the project
    3) Add a Component class to the project
    4) Change the Component class to inherit from System.Windows. Forms.TextBox.
    The IDE will complain that the class already inherits from Component.
    Change it so it inherits from TextBox instead.
    5) Build
    6) Add the Component to the User Control
    7) Build
    8) Add a User Control instance to the Form
    9) Copy the User Control you just added.
    10) Paste another instance to the form.

    Now you should see the expected user control duplicate. However, check
    out the control drop down list in the properties browser window. When
    you drop down the list you should see (using the default names)
    - Component11
    - Form1
    - UserControl11
    - UserControl12

    Why is Component11 there? All I did was copy UserControl11 and paste it
    as UserControl12. Why does the User Control's internal component get
    copied and becomes an external copy on the form. I find that I actually
    have to delete these extra components.

    Now if you copy/paste the second UserControl (the one you made with the
    first paste), you'll get TWO extra controls (assuming you didn't delete
    the first extra one).
    - Component12
    - object_6e47ae7a _3951_45fe_8305 _9870c2cff6fe (or some similar name)

    Am I neglecting to do something? Any information pointing me in the
    right direction would be helpful.

    Thanks
  • rowe_newsgroups

    #2
    Re: Weird UserControl behavior

    On Oct 1, 1:09 pm, Adam Biser <adam-at-REMOVEgoodinass ociates-dot-com>
    wrote:
    My apologies if this has been discussed before, but using Google and
    also searching the newsgroup has not given me any insight to this problem..
    >
    I'm experiencing some strange behavior when I copy and paste a
    usercontrol.  What happens is that the controls inside the usercontrol
    are being created on the form in addition to the copy of the usercontrol.
    >
    I'm using VS 2008 Pro, v9.0.21022.8 with .NET 3.5.
    >
    Here's how I can duplicate the problem:
    1) Create a new Windows Application project.
    2) Add a User Control class to the project
    3) Add a Component class to the project
    4) Change the Component class to inherit from System.Windows. Forms.TextBox.
    The IDE will complain that the class already inherits from Component.
    Change it so it inherits from TextBox instead.
    5) Build
    6) Add the Component to the User Control
    7) Build
    8) Add a User Control instance to the Form
    9) Copy the User Control you just added.
    10) Paste another instance to the form.
    >
    Now you should see the expected user control duplicate.  However, check
    out the control drop down list in the properties browser window.  When
    you drop down the list you should see (using the default names)
    - Component11
    - Form1
    - UserControl11
    - UserControl12
    >
    Why is Component11 there?  All I did was copy UserControl11 and paste it
    as UserControl12.  Why does the User Control's internal component get
    copied and becomes an external copy on the form.  I find that I actually
    have to delete these extra components.
    >
    Now if you copy/paste the second UserControl (the one you made with the
    first paste), you'll get TWO extra controls (assuming you didn't delete
    the first extra one).
    - Component12
    - object_6e47ae7a _3951_45fe_8305 _9870c2cff6fe (or some similar name)
    >
    Am I neglecting to do something?  Any information pointing me in the
    right direction would be helpful.
    >
    Thanks
    If you believe this is a bug you should report it to the .NET
    development teams using http://connect.microsoft.com/

    Thanks,

    Seth Rowe [MVP]

    Comment

    • Adam Biser

      #3
      Re: Weird UserControl behavior

      rowe_newsgroups wrote:
      On Oct 1, 1:09 pm, Adam Biser <adam-at-REMOVEgoodinass ociates-dot-com>
      wrote:
      >My apologies if this has been discussed before, but using Google and
      >also searching the newsgroup has not given me any insight to this problem..
      >>
      >I'm experiencing some strange behavior when I copy and paste a
      >usercontrol. What happens is that the controls inside the usercontrol
      >are being created on the form in addition to the copy of the usercontrol.
      >>
      >I'm using VS 2008 Pro, v9.0.21022.8 with .NET 3.5.
      >>
      >Here's how I can duplicate the problem:
      >1) Create a new Windows Application project.
      >2) Add a User Control class to the project
      >3) Add a Component class to the project
      >4) Change the Component class to inherit from System.Windows. Forms.TextBox.
      >The IDE will complain that the class already inherits from Component.
      >Change it so it inherits from TextBox instead.
      >5) Build
      >6) Add the Component to the User Control
      >7) Build
      >8) Add a User Control instance to the Form
      >9) Copy the User Control you just added.
      >10) Paste another instance to the form.
      >>
      >Now you should see the expected user control duplicate. However, check
      >out the control drop down list in the properties browser window. When
      >you drop down the list you should see (using the default names)
      >- Component11
      >- Form1
      >- UserControl11
      >- UserControl12
      >>
      >Why is Component11 there? All I did was copy UserControl11 and paste it
      >as UserControl12. Why does the User Control's internal component get
      >copied and becomes an external copy on the form. I find that I actually
      >have to delete these extra components.
      >>
      >Now if you copy/paste the second UserControl (the one you made with the
      >first paste), you'll get TWO extra controls (assuming you didn't delete
      >the first extra one).
      >- Component12
      >- object_6e47ae7a _3951_45fe_8305 _9870c2cff6fe (or some similar name)
      >>
      >Am I neglecting to do something? Any information pointing me in the
      >right direction would be helpful.
      >>
      >Thanks
      >
      If you believe this is a bug you should report it to the .NET
      development teams using http://connect.microsoft.com/
      >
      Thanks,
      >
      Seth Rowe [MVP]
      http://sethrowe.blogspot.com/
      Thanks for pointing me at that site. After digging around there awhile
      and not finding anything, I have posted it as a bug report.

      Adam

      Comment

      • rowe_newsgroups

        #4
        Re: Weird UserControl behavior

        On Oct 2, 12:58 pm, Adam Biser <adam-at-REMOVEgoodinass ociates-dot-
        comwrote:
        rowe_newsgroups wrote:
        On Oct 1, 1:09 pm, Adam Biser <adam-at-REMOVEgoodinass ociates-dot-com>
        wrote:
        My apologies if this has been discussed before, but using Google and
        also searching the newsgroup has not given me any insight to this problem..
        >
        I'm experiencing some strange behavior when I copy and paste a
        usercontrol.  What happens is that the controls inside the usercontrol
        are being created on the form in addition to the copy of the usercontrol.
        >
        I'm using VS 2008 Pro, v9.0.21022.8 with .NET 3.5.
        >
        Here's how I can duplicate the problem:
        1) Create a new Windows Application project.
        2) Add a User Control class to the project
        3) Add a Component class to the project
        4) Change the Component class to inherit from System.Windows. Forms.TextBox.
        The IDE will complain that the class already inherits from Component.
        Change it so it inherits from TextBox instead.
        5) Build
        6) Add the Component to the User Control
        7) Build
        8) Add a User Control instance to the Form
        9) Copy the User Control you just added.
        10) Paste another instance to the form.
        >
        Now you should see the expected user control duplicate.  However, check
        out the control drop down list in the properties browser window.  When
        you drop down the list you should see (using the default names)
        - Component11
        - Form1
        - UserControl11
        - UserControl12
        >
        Why is Component11 there?  All I did was copy UserControl11 and paste it
        as UserControl12.  Why does the User Control's internal component get
        copied and becomes an external copy on the form.  I find that I actually
        have to delete these extra components.
        >
        Now if you copy/paste the second UserControl (the one you made with the
        first paste), you'll get TWO extra controls (assuming you didn't delete
        the first extra one).
        - Component12
        - object_6e47ae7a _3951_45fe_8305 _9870c2cff6fe (or some similar name)
        >
        Am I neglecting to do something?  Any information pointing me in the
        right direction would be helpful.
        >
        Thanks
        >
        If you believe this is a bug you should report it to the .NET
        development teams usinghttp://connect.microso ft.com/
        >
        Thanks,
        >>
        Thanks for pointing me at that site.  After digging around there awhile
        and not finding anything, I have posted it as a bug report.
        >
        Adam
        Sorry I couldn't have been more help - but from experience when it
        comes to bugs there's not much more you can do except file a bug
        report.

        Thanks,

        Seth Rowe [MVP]

        Comment

        • Adam Biser

          #5
          Re: Weird UserControl behavior

          rowe_newsgroups wrote:
          On Oct 2, 12:58 pm, Adam Biser <adam-at-REMOVEgoodinass ociates-dot-
          comwrote:
          >rowe_newsgroup s wrote:
          >>On Oct 1, 1:09 pm, Adam Biser <adam-at-REMOVEgoodinass ociates-dot-com>
          >>wrote:
          >>>My apologies if this has been discussed before, but using Google and
          >>>also searching the newsgroup has not given me any insight to this problem..
          >>>I'm experiencing some strange behavior when I copy and paste a
          >>>usercontro l. What happens is that the controls inside the usercontrol
          >>>are being created on the form in addition to the copy of the usercontrol.
          >>>I'm using VS 2008 Pro, v9.0.21022.8 with .NET 3.5.
          >>>Here's how I can duplicate the problem:
          >>>1) Create a new Windows Application project.
          >>>2) Add a User Control class to the project
          >>>3) Add a Component class to the project
          >>>4) Change the Component class to inherit from System.Windows. Forms.TextBox.
          >>>The IDE will complain that the class already inherits from Component.
          >>>Change it so it inherits from TextBox instead.
          >>>5) Build
          >>>6) Add the Component to the User Control
          >>>7) Build
          >>>8) Add a User Control instance to the Form
          >>>9) Copy the User Control you just added.
          >>>10) Paste another instance to the form.
          >>>Now you should see the expected user control duplicate. However, check
          >>>out the control drop down list in the properties browser window. When
          >>>you drop down the list you should see (using the default names)
          >>>- Component11
          >>>- Form1
          >>>- UserControl11
          >>>- UserControl12
          >>>Why is Component11 there? All I did was copy UserControl11 and paste it
          >>>as UserControl12. Why does the User Control's internal component get
          >>>copied and becomes an external copy on the form. I find that I actually
          >>>have to delete these extra components.
          >>>Now if you copy/paste the second UserControl (the one you made with the
          >>>first paste), you'll get TWO extra controls (assuming you didn't delete
          >>>the first extra one).
          >>>- Component12
          >>>- object_6e47ae7a _3951_45fe_8305 _9870c2cff6fe (or some similar name)
          >>>Am I neglecting to do something? Any information pointing me in the
          >>>right direction would be helpful.
          >>>Thanks
          >>If you believe this is a bug you should report it to the .NET
          >>development teams usinghttp://connect.microso ft.com/
          >>Thanks,
          >>Seth Rowe [MVP]
          >>http://sethrowe.blogspot.com/
          >Thanks for pointing me at that site. After digging around there awhile
          >and not finding anything, I have posted it as a bug report.
          >>
          >Adam
          >
          Sorry I couldn't have been more help - but from experience when it
          comes to bugs there's not much more you can do except file a bug
          report.
          >
          Thanks,
          >
          Seth Rowe [MVP]
          http://sethrowe.blogspot.com/
          I wasn't sure if it was a bug or if I was doing something wrong. Since
          searching yielded no results, I thought it must be what I'm doing or not
          doing.

          Thanks again for pointing me in the direction of that site,
          Adam

          Comment

          Working...