Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
Password Reminder
Register
| FAQ | Members List | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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
Reply With Quote
  #2 (permalink)  
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?
Reply With Quote
  #3 (permalink)  
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.

Reply With Quote
  #4 (permalink)  
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.
Reply With Quote
  #5 (permalink)  
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.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 08:56 AM.


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