Results 1 to 3 of 3

Thread: [RESOLVED] [2005] AnchorStyles.All?

  1. #1

    Thread Starter
    Member Griminal's Avatar
    Join Date
    Aug 2005
    Location
    Bangor, MI
    Posts
    61

    Resolved [RESOLVED] [2005] AnchorStyles.All?

    I'm trying to set all anchors on a control via code. Is there a way to do it? Or is there different way to achieve the same result?

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

    Re: [2005] AnchorStyles.All?

    Perform a bitwise OR operation:
    VB Code:
    1. myControl.Anchor = AnchorStyles.Top Or AnchorStyles.Bottom Or AnchorStyles.Left Or AnchorStyles.Right
    A Bitwise OR will set a bit in the result if that bit is set in either operand. Each AnchorStyles value has one and only one bit set, plus each is different to the others. In binary that operation looks something like this:
    Code:
    00000001
    00000010
    00000100
    00001000
    ---------
    00001111
    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

  3. #3

    Thread Starter
    Member Griminal's Avatar
    Join Date
    Aug 2005
    Location
    Bangor, MI
    Posts
    61

    Re: [2005] AnchorStyles.All?

    Thanks. I'll give it a try.

    *edit*

    Works perfectly! Thanks J.
    Last edited by Griminal; Feb 7th, 2007 at 01:46 PM.

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