strange resize problems using inherited VB.NET forms

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

    strange resize problems using inherited VB.NET forms

    I am getting strange resizing problems when using an inherited form.

    Controls are moving themselves seemingly randomly, but reproducibly.

    "frmBase" is my base class (a windows form), and contains a few controls
    anchored to the sides of the form.

    "frmChild" inherits from "frmBase".. . and the controls appear on the
    inherited form as expected. However things start going wrong when I place
    addition controls on the "frmChild" form. When I rebuild the project, the
    original base controls move to new locations (often off the bounds of the
    form). If I remove the new controls to the child class and then rebuild,
    violia, the original base control's snap back to the correct locations!!

    What in the heck is going on here? It seems that I can't use inherited
    forms for this reason... but I really want too.

    - Peter
    PS. Version 7.1.3088


  • Spam Trap

    #2
    Re: strange resize problems using inherited VB.NET forms


    "Spam Trap" <spam@midar.com > wrote in message
    news:400951c4$0 $26115$afc38c87 @news.optusnet. com.au...[color=blue]
    > I am getting strange resizing problems when using an inherited form.
    >
    > Controls are moving themselves seemingly randomly, but reproducibly.
    >
    > "frmBase" is my base class (a windows form), and contains a few controls
    > anchored to the sides of the form.
    >
    > "frmChild" inherits from "frmBase".. . and the controls appear on the
    > inherited form as expected. However things start going wrong when I place
    > addition controls on the "frmChild" form. When I rebuild the project, the
    > original base controls move to new locations (often off the bounds of the
    > form). If I remove the new controls to the child class and then rebuild,
    > violia, the original base control's snap back to the correct locations!!
    >
    > What in the heck is going on here? It seems that I can't use inherited
    > forms for this reason... but I really want too.
    >
    > - Peter
    > PS. Version 7.1.3088
    >
    >[/color]

    To answer my own question (a least a little bit)...

    It looks like a serious error with the anchor property on the inherited
    form... unless I'm missing something pretty obvious?

    - Peter


    Comment

    • Spam Trap

      #3
      Re: strange resize problems using inherited VB.NET forms

      "Spam Trap" <spam@midar.com > wrote in message
      news:4009565b$0 $14480$afc38c87 @news.optusnet. com.au...[color=blue]
      >
      > "Spam Trap" <spam@midar.com > wrote in message
      > news:400951c4$0 $26115$afc38c87 @news.optusnet. com.au...[color=green]
      > > I am getting strange resizing problems when using an inherited form.
      > >
      > > Controls are moving themselves seemingly randomly, but reproducibly.
      > >
      > > "frmBase" is my base class (a windows form), and contains a few controls
      > > anchored to the sides of the form.
      > >
      > > "frmChild" inherits from "frmBase".. . and the controls appear on the
      > > inherited form as expected. However things start going wrong when I[/color][/color]
      place[color=blue][color=green]
      > > addition controls on the "frmChild" form. When I rebuild the project,[/color][/color]
      the[color=blue][color=green]
      > > original base controls move to new locations (often off the bounds of[/color][/color]
      the[color=blue][color=green]
      > > form). If I remove the new controls to the child class and then rebuild,
      > > violia, the original base control's snap back to the correct locations!!
      > >
      > > What in the heck is going on here? It seems that I can't use inherited
      > > forms for this reason... but I really want too.
      > >
      > > - Peter
      > > PS. Version 7.1.3088
      > >
      > >[/color]
      >
      > To answer my own question (a least a little bit)...
      >
      > It looks like a serious error with the anchor property on the inherited
      > form... unless I'm missing something pretty obvious?
      >
      > - Peter
      >
      >[/color]
      Ok... another update. The problem appears when the base classes control's
      have their modifier properties set to Friend (which should be ok... but
      isn't for some reason). I change their modifer properties to Public and the
      problem stopped.

      It's not an ideal, and would still like to hear why this is so. The Help
      file cautions Inheritors, but I don't fully understand if this applies in my
      case.

      - Peter


      Comment

      • Spam Trap

        #4
        Re: strange resize problems using inherited VB.NET forms

        "Spam Trap" <spam@midar.com > wrote in message
        news:400961ce$0 $4052$afc38c87@ news.optusnet.c om.au...[color=blue]
        > "Spam Trap" <spam@midar.com > wrote in message
        > news:4009565b$0 $14480$afc38c87 @news.optusnet. com.au...[color=green]
        > >
        > > "Spam Trap" <spam@midar.com > wrote in message
        > > news:400951c4$0 $26115$afc38c87 @news.optusnet. com.au...[color=darkred]
        > > > I am getting strange resizing problems when using an inherited form.
        > > >
        > > > Controls are moving themselves seemingly randomly, but reproducibly.
        > > >
        > > > "frmBase" is my base class (a windows form), and contains a few[/color][/color][/color]
        controls[color=blue][color=green][color=darkred]
        > > > anchored to the sides of the form.
        > > >
        > > > "frmChild" inherits from "frmBase".. . and the controls appear on the
        > > > inherited form as expected. However things start going wrong when I[/color][/color]
        > place[color=green][color=darkred]
        > > > addition controls on the "frmChild" form. When I rebuild the project,[/color][/color]
        > the[color=green][color=darkred]
        > > > original base controls move to new locations (often off the bounds of[/color][/color]
        > the[color=green][color=darkred]
        > > > form). If I remove the new controls to the child class and then[/color][/color][/color]
        rebuild,[color=blue][color=green][color=darkred]
        > > > violia, the original base control's snap back to the correct[/color][/color][/color]
        locations!![color=blue][color=green][color=darkred]
        > > >
        > > > What in the heck is going on here? It seems that I can't use[/color][/color][/color]
        inherited[color=blue][color=green][color=darkred]
        > > > forms for this reason... but I really want too.
        > > >
        > > > - Peter
        > > > PS. Version 7.1.3088
        > > >
        > > >[/color]
        > >
        > > To answer my own question (a least a little bit)...
        > >
        > > It looks like a serious error with the anchor property on the inherited
        > > form... unless I'm missing something pretty obvious?
        > >
        > > - Peter
        > >
        > >[/color]
        > Ok... another update. The problem appears when the base classes control's
        > have their modifier properties set to Friend (which should be ok... but
        > isn't for some reason). I change their modifer properties to Public and[/color]
        the[color=blue]
        > problem stopped.
        >
        > It's not an ideal, and would still like to hear why this is so. The Help
        > file cautions Inheritors, but I don't fully understand if this applies in[/color]
        my[color=blue]
        > case.
        >
        > - Peter
        >
        >[/color]

        Ok... back to my original point. Does anyone know of a fix.

        I've come to the conclusion that inherited forms with controls that are
        archored are the BUGGIEST things on Earth!

        BUG BUG BUG BUG BUG.... please... someone proove me wrong? Can anyone at
        least find a KB article on this - I can't.

        - Peter


        Comment

        • IbrahimMalluf

          #5
          Re: strange resize problems using inherited VB.NET forms

          Hello Peter



          I created a Base class called frmBase and placed 2 text boxes
          and one combo on it

          I anchored them left.top,right



          I created a child form called frmChild and inherited from
          frmBase. I them placed 2 textboxes and one datagrid on the form. I anchored
          them top and right



          I ran the project. Sizing worked just fine and nothing moved
          abnormally that I could tell.



          I am also running 7.1.3088 on Win2k



          Can you give a more precise example?






          --
          Ibrahim Malluf
          JOSWD805 menyediakan link login yang di update terus setiap hari agar tidak terkena nawala,agar memudahkan para slotter untuk bermain. JOSWD805 menjadi satu-satunya tempat para penggemar slot gacor untuk mencari pengalaman seru, kemenangan besar, serta berbagai permainan yang lagi gacor hari ini.

          =============== =============== =============== =
          MCS Data Services Code Generator

          =============== =============== =============== =
          Pocket PC Return On Investment Calculator
          Free Download http://64.78.34.175/mcsnet/kwickKalk1.aspx



          "Spam Trap" <spam@midar.com > wrote in message
          news:400951c4$0 $26115$afc38c87 @news.optusnet. com.au...[color=blue]
          > I am getting strange resizing problems when using an inherited form.
          >
          > Controls are moving themselves seemingly randomly, but reproducibly.
          >
          > "frmBase" is my base class (a windows form), and contains a few controls
          > anchored to the sides of the form.
          >
          > "frmChild" inherits from "frmBase".. . and the controls appear on the
          > inherited form as expected. However things start going wrong when I place
          > addition controls on the "frmChild" form. When I rebuild the project, the
          > original base controls move to new locations (often off the bounds of the
          > form). If I remove the new controls to the child class and then rebuild,
          > violia, the original base control's snap back to the correct locations!!
          >
          > What in the heck is going on here? It seems that I can't use inherited
          > forms for this reason... but I really want too.
          >
          > - Peter
          > PS. Version 7.1.3088
          >
          >[/color]


          Comment

          • Spam Trap

            #6
            Re: strange resize problems using inherited VB.NET forms

            thank you for taking the time to examine my problem. Yes, this is a strange
            one. If you do things in a nice neat order, then there is no problem. The
            problems start to occur when you move or remove controls on the inherited
            form. And let's face it... you're always fiddling with form to get them
            looking just right. Try archoring a button bottom-right on the base class,
            then placing a groupbox onto the child form that is anchored to all sides.
            Now... when you rebuild the project, the original buttons location has
            changed for no reason.

            What is causing this bizzare behaviour??

            Thank you in advance.

            - Peter


            "IbrahimMal luf" <Ibrahim@malluf .com> wrote in message
            news:uFYR1BS3DH A.3216@TK2MSFTN GP11.phx.gbl...[color=blue]
            > Hello Peter
            >
            >
            >
            > I created a Base class called frmBase and placed 2 text boxes
            > and one combo on it
            >
            > I anchored them left.top,right
            >
            >
            >
            > I created a child form called frmChild and inherited from
            > frmBase. I them placed 2 textboxes and one datagrid on the form. I[/color]
            anchored[color=blue]
            > them top and right
            >
            >
            >
            > I ran the project. Sizing worked just fine and nothing moved
            > abnormally that I could tell.
            >
            >
            >
            > I am also running 7.1.3088 on Win2k
            >
            >
            >
            > Can you give a more precise example?
            >
            >
            >
            >
            >
            >
            > --
            > Ibrahim Malluf
            > http://www.malluf.com
            > =============== =============== =============== =
            > MCS Data Services Code Generator
            > http://64.78.34.175/mcsnet/DSCG/Announcement.aspx
            > =============== =============== =============== =
            > Pocket PC Return On Investment Calculator
            > Free Download http://64.78.34.175/mcsnet/kwickKalk1.aspx
            >
            >
            >
            > "Spam Trap" <spam@midar.com > wrote in message
            > news:400951c4$0 $26115$afc38c87 @news.optusnet. com.au...[color=green]
            > > I am getting strange resizing problems when using an inherited form.
            > >
            > > Controls are moving themselves seemingly randomly, but reproducibly.
            > >
            > > "frmBase" is my base class (a windows form), and contains a few controls
            > > anchored to the sides of the form.
            > >
            > > "frmChild" inherits from "frmBase".. . and the controls appear on the
            > > inherited form as expected. However things start going wrong when I[/color][/color]
            place[color=blue][color=green]
            > > addition controls on the "frmChild" form. When I rebuild the project,[/color][/color]
            the[color=blue][color=green]
            > > original base controls move to new locations (often off the bounds of[/color][/color]
            the[color=blue][color=green]
            > > form). If I remove the new controls to the child class and then rebuild,
            > > violia, the original base control's snap back to the correct locations!!
            > >
            > > What in the heck is going on here? It seems that I can't use inherited
            > > forms for this reason... but I really want too.
            > >
            > > - Peter
            > > PS. Version 7.1.3088
            > >
            > >[/color]
            >
            >[/color]


            Comment

            • Spam Trap

              #7
              Re: strange resize problems using inherited VB.NET forms

              If I remark out the following line of code...
              Me.SuspendLayou t()

              ....from the inherited form, then the next time the screen is
              refreshed/drawn, it is drawn properly without errors. However, VB.NET resets
              this line of code.

              There seems to be a bug in this area... unless I'm missing something (and I
              still think I am?)

              - Peter

              "Spam Trap" <spam@midar.com > wrote in message
              news:400a0411$0 $26119$afc38c87 @news.optusnet. com.au...
              [color=blue]
              > thank you for taking the time to examine my problem. Yes, this is a[/color]
              strange[color=blue]
              > one. If you do things in a nice neat order, then there is no problem. The
              > problems start to occur when you move or remove controls on the inherited
              > form. And let's face it... you're always fiddling with form to get them
              > looking just right. Try archoring a button bottom-right on the base class,
              > then placing a groupbox onto the child form that is anchored to all sides.
              > Now... when you rebuild the project, the original buttons location has
              > changed for no reason.
              >
              > What is causing this bizzare behaviour??
              >
              > Thank you in advance.
              >
              > - Peter
              >
              >
              > "IbrahimMal luf" <Ibrahim@malluf .com> wrote in message
              > news:uFYR1BS3DH A.3216@TK2MSFTN GP11.phx.gbl...[color=green]
              > > Hello Peter
              > >
              > >
              > >
              > > I created a Base class called frmBase and placed 2 text[/color][/color]
              boxes[color=blue][color=green]
              > > and one combo on it
              > >
              > > I anchored them left.top,right
              > >
              > >
              > >
              > > I created a child form called frmChild and inherited from
              > > frmBase. I them placed 2 textboxes and one datagrid on the form. I[/color]
              > anchored[color=green]
              > > them top and right
              > >
              > >
              > >
              > > I ran the project. Sizing worked just fine and nothing[/color][/color]
              moved[color=blue][color=green]
              > > abnormally that I could tell.
              > >
              > >
              > >
              > > I am also running 7.1.3088 on Win2k
              > >
              > >
              > >
              > > Can you give a more precise example?
              > >
              > >
              > >
              > >
              > >
              > >
              > > --
              > > Ibrahim Malluf
              > > http://www.malluf.com
              > > =============== =============== =============== =
              > > MCS Data Services Code Generator
              > > http://64.78.34.175/mcsnet/DSCG/Announcement.aspx
              > > =============== =============== =============== =
              > > Pocket PC Return On Investment Calculator
              > > Free Download http://64.78.34.175/mcsnet/kwickKalk1.aspx
              > >
              > >
              > >
              > > "Spam Trap" <spam@midar.com > wrote in message
              > > news:400951c4$0 $26115$afc38c87 @news.optusnet. com.au...[color=darkred]
              > > > I am getting strange resizing problems when using an inherited form.
              > > >
              > > > Controls are moving themselves seemingly randomly, but reproducibly.
              > > >
              > > > "frmBase" is my base class (a windows form), and contains a few[/color][/color][/color]
              controls[color=blue][color=green][color=darkred]
              > > > anchored to the sides of the form.
              > > >
              > > > "frmChild" inherits from "frmBase".. . and the controls appear on the
              > > > inherited form as expected. However things start going wrong when I[/color][/color]
              > place[color=green][color=darkred]
              > > > addition controls on the "frmChild" form. When I rebuild the project,[/color][/color]
              > the[color=green][color=darkred]
              > > > original base controls move to new locations (often off the bounds of[/color][/color]
              > the[color=green][color=darkred]
              > > > form). If I remove the new controls to the child class and then[/color][/color][/color]
              rebuild,[color=blue][color=green][color=darkred]
              > > > violia, the original base control's snap back to the correct[/color][/color][/color]
              locations!![color=blue][color=green][color=darkred]
              > > >
              > > > What in the heck is going on here? It seems that I can't use[/color][/color][/color]
              inherited[color=blue][color=green][color=darkred]
              > > > forms for this reason... but I really want too.
              > > >
              > > > - Peter
              > > > PS. Version 7.1.3088
              > > >
              > > >[/color]
              > >
              > >[/color]
              >
              >[/color]


              Comment

              • Spam Trap

                #8
                Re: strange resize problems using inherited VB.NET forms

                Found this... although I can't promise it's accurate. Looks like the author
                of the article needs to do more testing.

                Microsoft Knowledge Base Article - 316560
                FIX: Anchored Control on Inherited Form Changes Location When You Recompile


                They claim this is a fix... but it isn't. I still have the problem in .NET
                1.1.4322

                This makes me mad! Crappy code. The "fix" (if you can call it a fix) is
                NEVER to resize your forms. Not in design time - or run time! Crazy!

                - Peter
                PS. I have spent over 18 hours on this problem... and enough is enough.
                VB.NET inherited forms that use anchored controls on the base class are
                simply buggy. Microsoft has not given a commitment to fix the problem, and
                their acknowledgement via KB article seems to suggest they have fixed it,
                when really the have not. I have contact them via e-mail about this
                problem... but I have no idea if this will fall on deaf ears.


                "Spam Trap" <spam@midar.com > wrote in message
                news:400a2163$0 $14485$afc38c87 @news.optusnet. com.au...[color=blue]
                > If I remark out the following line of code...
                > Me.SuspendLayou t()
                >
                > ...from the inherited form, then the next time the screen is
                > refreshed/drawn, it is drawn properly without errors. However, VB.NET[/color]
                resets[color=blue]
                > this line of code.
                >
                > There seems to be a bug in this area... unless I'm missing something (and[/color]
                I[color=blue]
                > still think I am?)
                >
                > - Peter
                >
                > "Spam Trap" <spam@midar.com > wrote in message
                > news:400a0411$0 $26119$afc38c87 @news.optusnet. com.au...
                >[color=green]
                > > thank you for taking the time to examine my problem. Yes, this is a[/color]
                > strange[color=green]
                > > one. If you do things in a nice neat order, then there is no problem.[/color][/color]
                The[color=blue][color=green]
                > > problems start to occur when you move or remove controls on the[/color][/color]
                inherited[color=blue][color=green]
                > > form. And let's face it... you're always fiddling with form to get them
                > > looking just right. Try archoring a button bottom-right on the base[/color][/color]
                class,[color=blue][color=green]
                > > then placing a groupbox onto the child form that is anchored to all[/color][/color]
                sides.[color=blue][color=green]
                > > Now... when you rebuild the project, the original buttons location has
                > > changed for no reason.
                > >
                > > What is causing this bizzare behaviour??
                > >
                > > Thank you in advance.
                > >
                > > - Peter
                > >
                > >
                > > "IbrahimMal luf" <Ibrahim@malluf .com> wrote in message
                > > news:uFYR1BS3DH A.3216@TK2MSFTN GP11.phx.gbl...[color=darkred]
                > > > Hello Peter
                > > >
                > > >
                > > >
                > > > I created a Base class called frmBase and placed 2 text[/color][/color]
                > boxes[color=green][color=darkred]
                > > > and one combo on it
                > > >
                > > > I anchored them left.top,right
                > > >
                > > >
                > > >
                > > > I created a child form called frmChild and inherited from
                > > > frmBase. I them placed 2 textboxes and one datagrid on the form. I[/color]
                > > anchored[color=darkred]
                > > > them top and right
                > > >
                > > >
                > > >
                > > > I ran the project. Sizing worked just fine and nothing[/color][/color]
                > moved[color=green][color=darkred]
                > > > abnormally that I could tell.
                > > >
                > > >
                > > >
                > > > I am also running 7.1.3088 on Win2k
                > > >
                > > >
                > > >
                > > > Can you give a more precise example?
                > > >
                > > >
                > > >
                > > >
                > > >
                > > >
                > > > --
                > > > Ibrahim Malluf
                > > > http://www.malluf.com
                > > > =============== =============== =============== =
                > > > MCS Data Services Code Generator
                > > > http://64.78.34.175/mcsnet/DSCG/Announcement.aspx
                > > > =============== =============== =============== =
                > > > Pocket PC Return On Investment Calculator
                > > > Free Download http://64.78.34.175/mcsnet/kwickKalk1.aspx
                > > >
                > > >
                > > >
                > > > "Spam Trap" <spam@midar.com > wrote in message
                > > > news:400951c4$0 $26115$afc38c87 @news.optusnet. com.au...
                > > > > I am getting strange resizing problems when using an inherited form.
                > > > >
                > > > > Controls are moving themselves seemingly randomly, but reproducibly.
                > > > >
                > > > > "frmBase" is my base class (a windows form), and contains a few[/color][/color]
                > controls[color=green][color=darkred]
                > > > > anchored to the sides of the form.
                > > > >
                > > > > "frmChild" inherits from "frmBase".. . and the controls appear on the
                > > > > inherited form as expected. However things start going wrong when I[/color]
                > > place[color=darkred]
                > > > > addition controls on the "frmChild" form. When I rebuild the[/color][/color][/color]
                project,[color=blue][color=green]
                > > the[color=darkred]
                > > > > original base controls move to new locations (often off the bounds[/color][/color][/color]
                of[color=blue][color=green]
                > > the[color=darkred]
                > > > > form). If I remove the new controls to the child class and then[/color][/color]
                > rebuild,[color=green][color=darkred]
                > > > > violia, the original base control's snap back to the correct[/color][/color]
                > locations!![color=green][color=darkred]
                > > > >
                > > > > What in the heck is going on here? It seems that I can't use[/color][/color]
                > inherited[color=green][color=darkred]
                > > > > forms for this reason... but I really want too.
                > > > >
                > > > > - Peter
                > > > > PS. Version 7.1.3088
                > > > >
                > > > >
                > > >
                > > >[/color]
                > >
                > >[/color]
                >
                >[/color]


                Comment

                • jon

                  #9
                  Re: strange resize problems using inherited VB.NET forms

                  I'm having a similar problem

                  I'm not inheriting the forms, though. I've created a simple form and everything was fine until I copied and pasted it into the same project to start another similar form. Now the form doesn't save its dimensions properly. When I save and close visual studio and then reopen, the form changes it's size and the buttons move around. I've unselected all of the anchors from the buttons and it still does it. If I resize the form at design time, the buttons are moving up and down the form at about one half the distance that I am resizing the bottom of the form

                  This is weird and I really haven't been able to find any mention of the problem elsewhere.

                  Comment

                  Working...