strange resize problems using inherited VB.NET forms

G

Guest

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
 
G

Guest

Spam Trap said:
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

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
 
G

Guest

Spam Trap said:
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
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
 
G

Guest

Spam Trap said:
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

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
 
I

IbrahimMalluf

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
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
 
G

Guest

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
 
G

Guest

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

....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
 
G

Guest

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
http://support.microsoft.com/default.aspx?scid=kb;en-us;316560

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.
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top