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 / August 2005

Tip: Looking for answers? Try searching our database.

CheckBox as Groupbox caption

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
josef - 05 Aug 2005 09:05 GMT
hello,

how do i create a groupbox which has a checkbox instead of a label as
caption. with that checkbox i want to enable/disable the controls inside the
groupbox

thanks
Chris Dunaway - 05 Aug 2005 14:43 GMT
I found this link but the code is in C++.  Perhaps it will give you
some ideas!

http://www.codeproject.com/buttonctrl/groupcheck123.asp
Tim Wilson - 05 Aug 2005 14:48 GMT
Just set the Text of the GroupBox to an empty string, add a CheckBox, place
it at the top of the GroupBox, hook into the CheckedChanged event for the
CheckBox, and inside this event handler you can traverse the Controls
collection for the GroupBox and set the Enabled property of each control to
the proper state based on the CheckBox Checked property. You'll need to go
through each control so that you can purposely skip the CheckBox. The other
option is to place all the controls, except the CheckBox, onto a Panel and
then just enable/disable the Panel.

private void checkBox1_CheckedChanged(object sender, System.EventArgs e)
{
 foreach (Control ctrl in this.groupBox1.Controls)
 {
   if (ctrl != this.checkBox1)
   {
     ctrl.Enabled = this.checkBox1.Checked;
   }
 }
}

Signature

Tim Wilson
.Net Compact Framework MVP

> hello,
>
[quoted text clipped - 3 lines]
>
> thanks

Rate this thread:







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.