Build error when changing max or min size of form

G

Guest

Changing the max or min size of a form can be in code, but if I do that then
it causes build errors in my application. The build error is: Expression is
a value and therefore cannot be the target of an assignment. If the program
is run in spite of the build errors then we see that the code actually works.

Is there a way to resolve the build error issue?

I am using VB.NET. Microsoft Developement Environment 2002 v7.0.9466. .NET
Framework 1.0 v1.0.3705.

The same thing also happens in Microsoft Developement Environment 2003
v7.1.3088. .NET Framework 1.1 v1.1.4322.

Below is the code that I am trying to use. I am trying to make a form that
cannot be resized by the user.

Me.MaximumSize.Height = Me.Size.Height
Me.MaximumSize.Width = Me.Size.Width
Me.MinimumSize.Height = Me.Size.Height
Me.MinimumSize.Width = Me.Size.Width

My current workaround is to set these values in the Design mode of the form,
but I would rather do it in code because the form is easier to maintain if
the size only has to be changed in one place--in case the developer needs to
change the size of the form or copy the form to make a new one that is just
like it.

Thank you.
-John
 
G

Guest

Solution:
Me.MinimumSize = Me.Size
Me.MaximumSize = Me.Size

Not that it matters, but I guess I thought that I could change (or set)
Me.MinimumSize.Height since the Intellisense description of that property was:
Gets or sets the vertical component of this System.Drawing.Size.

John Tighe said:
Changing the max or min size of a form can be in code, but if I do that then
it causes build errors in my application. The build error is: Expression is
a value and therefore cannot be the target of an assignment. If the program
is run in spite of the build errors then we see that the code actually works.

Well, if there were build errors then an .exe was not created, so if you
procede then you are really running the last .exe that was built with no
errors.
 

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