Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET 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 October 22nd, 2004, 11:00 AM
Registered User
Join Date: Oct 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default ListBoxes problems

This may sound a little weird, even a little embarrassing.
In a web form I have two list boxes that act as a grid to grid control. You select a couple of items from the left control push a button and they get moved to the second control. I said MOVED not copied. The way it's done I iterate through the items using foreach loop if the ITEM is selected then I take that Item and I ADD IT to the second listbox, then I remove it from the first simple ain’t it?

Here is the problem, when I select the last Item and then I move it to the other list the first Item on the list gets moved not the one I selected. Visually the first item is not highlighted meaning it is not selected, but when I run through a debug session I see that it’s Selected attribute is set to true! There are other weird selection issues as well but I won’t get into much detail. The bottom line they all exhibit the same behavior.

I do have another control that has the very same logic that does not cause such a problem. Has anybody experience or even heard of something similar? Do I point finger at .NET or I am missing something in my code?

Thanks guys.

Old October 25th, 2004, 10:48 AM
Registered User
Join Date: Oct 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts

Found it! I thought sharing this discovery with you since nobody took on the challenge to find it :-).

Item values should be unique. If two Items have the same value the problem will reproduce constantly. My first intuition was right, "Point finger at Microsoft". I knew this .Net Business is too good to be true, can't even make sure that a stupid listbox is working adequately.


Similar Threads
Thread Thread Starter Forum Replies Last Post
getting Listboxes to communicate susan_ny ASP.NET 2.0 Basics 1 January 26th, 2006 11:41 PM
Listboxes Sub-Listboxes and Table Linking MJB05 Access 4 September 20th, 2005 12:37 PM
Listboxes and Arrays interrupt Javascript How-To 1 August 2nd, 2004 01:55 PM
Filtering listboxes Bill Snow VB Databases Basics 0 February 5th, 2004 03:32 PM
Listboxes Alaric VS.NET 2002/2003 1 October 29th, 2003 11:54 AM

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