Results 1 to 2 of 2

Thread: Saving to MyBase.Size from height and width values, (a more complex way?)

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2007
    Posts
    28

    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

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Saving to MyBase.Size from height and width values, (a more complex way?)

    Firstly, this is not legal:
    vb.net Code:
    1. MyBase.Size.Height = Height
    That would throw a compilation error. This is what you want:
    vb.net Code:
    1. Me.Size = New Size(newWidth, newHeight)
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width