Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
| Search | Today's Posts | Mark Forums Read
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 23rd, 2005, 07:19 PM
Authorized User
 
Join Date: Jul 2003
Location: , , .
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default Managing exclusions in windows forms

I am building a UI for an application that has quite a few exclusions, at least that is what I call them. What I mean is that when I select Option 3, Options 12, 14 and Item 5 in ListBoxJ are disabled because the are mutually exclusive of Option 3.

I can do it by coding
Code:
Me.Option12.Enabled=False
Me.Option14.Enabled=False
ad infinitum for each and every option on my form (currently 17 controls but will grow as the application develops). I am wondering if there is some standard way of dealing with this in the VB.Net world, or is it just a manual process like I described.

Thanks for any hints.

misterqj
 
Old February 24th, 2005, 11:50 AM
Friend of Wrox
 
Join Date: Nov 2004
Location: Port Orchard, WA, USA.
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Is there a pattern to this?
 
Old February 24th, 2005, 03:00 PM
Authorized User
 
Join Date: Jul 2003
Location: , , .
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

There isn't really a pattern. The interface is alot like a print driver. When you select one option for the device, other options get disabled because they don't apply. The set of controls that get disabled when Option1 is selected is very diferent from the set the gets disabled when Option3 is selected.

 
Old February 25th, 2005, 01:17 PM
Friend of Wrox
 
Join Date: Nov 2004
Location: Port Orchard, WA, USA.
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

I think you’re just going to have to do it the long-winded way.

When I have had to do things like this in the past I have tried to create a routine (a Sub) that encapsulates the behavior. So I have a Sub like 'Option_1()' that sets all of the controls one way, one named 'Option_2()' that sets them another, and so on (with meaningful names for the Subs).
That way I can set the line-after-line-after-line of code off to the side, and have a much more readable routine where the particular selection is being ascertained.
 
Old February 25th, 2005, 04:59 PM
Authorized User
 
Join Date: Jul 2003
Location: , , .
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the input Brian. That is effectively what I ended up doing. I tried a couple of different permutations using arrays, but it really ended up being messier.

Putting the UI managment code in it's own sub at least keeps it out of the way visually.





Similar Threads
Thread Thread Starter Forum Replies Last Post
windows forms lakshmiR .NET Framework 1.x 1 August 31st, 2007 08:32 PM
Help with Windows Forms tycotrix C# 1 January 16th, 2007 11:58 AM
windows forms chandrasekhar ASP.NET 2.0 Professional 2 February 27th, 2006 10:41 PM
Windows forms eyan C# 1 July 1st, 2004 04:10 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.