Saving to MyBase.Size from height and width values, (a more complex way?)
Hello,
What I am trying to do is to be able to grab the points of say a square, and after I calculate the width and height of it, convert it to a Size value. Now I know I can do something such as MyBase.Size.Height = Height, or the Width likewise but I would like to know how to do it so that I could do something such as MyBase.Size = (Height,Width), or something like that. How would I go about doing this? I am trying to write clean code and doing this with the .Height and .Width attributes would cause me to both write more code but also have to bind to twice as many database records. I am also curious of a method to solve this because what if I have something that can have several degrees of freedom other than just the 2 of .Height and .Width, the code could really become messy so I am trying to understand how I might be able to save settings at a more general level directly such as in this case to .Size.
Any thoughts?
Thanks much,
Brian
Re: Saving to MyBase.Size from height and width values, (a more complex way?)
Firstly, this is not legal:
vb.net Code:
MyBase.Size.Height = Height
That would throw a compilation error. This is what you want:
vb.net Code:
Me.Size = New Size(newWidth, newHeight)