Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / June 2007

Tip: Looking for answers? Try searching our database.

DockStyle value

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bulat Baltin - 12 Jun 2007 14:11 GMT
Hello,

I try to use Dock property in UserControl (if it matters) in the
following way

this.Dock = DockStyle.Left | DockStyle.Bottom | DockStyle.Right;

At runtime I gets :

System.ComponentModel.InvalidEnumArgumentException: The value of
argument 'value' (7) is invalid for Enum type 'DockStyle'.

How to fix it?

Regards,
Bulat Baltin
Alex Meleta - 12 Jun 2007 15:25 GMT
Hi,

because method this.Dock contains something like this:

if (!((value >= 0) && (value <= 5)))
       {
           throw new InvalidEnumArgumentException("value", (int) value,
typeof(DockStyle));
       }

but DockStyle { None =0, Top, Bottom, Left = 3, Right = 4, Fill = 5 } with
combination DockStyle.Left | DockStyle.Right give you 7.

Regards,
Alex
http://devkids.blogspot.com

> Hello,
>
[quoted text clipped - 12 lines]
> Regards,
> Bulat Baltin
Bulat Baltin - 12 Jun 2007 16:21 GMT
Hello Alex,
Thanks. I just discovered that in my case

this.Dock = DockStyle.Bottom;

is enough and actually does what I wanted - docking to left and right
borders as well. The misleading fact for me was that in other place
for docking to left border I used

this.Dock = DockStyle.Top | DockStyle.Bottom | DockStyle.Left;

and it worked well. Now I see that DockStyle.Left is enough.

Regards,
Bulat Baltin.
G Himangi - 19 Jun 2007 11:51 GMT
You can only dock to one edge at a time...this means that the Dockstyle
values should not be or'ed

---------
- G Himangi,   Sky Software       http://www.ssware.com
Shell MegaPack : GUI Controls For Drop-In Windows Explorer like Shell
Browsing Functionality For Your App (.Net & ActiveX Editions).
EZNamespaceExtensions.Net : Develop namespace extensions rapidly in .Net
EZShellExtensions.Net : Develop all shell extensions,explorer bars and BHOs
rapidly in .Net
---------

> Hello,
>
[quoted text clipped - 12 lines]
> Regards,
> Bulat Baltin

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.