Current location: Hot Scripts Forums » Programming Languages » Windows .NET Programming » Problem using listbox with multi selection set


Problem using listbox with multi selection set

Reply
  #1 (permalink)  
Old 08-19-05, 09:03 AM
nidkil nidkil is offline
New Member
 
Join Date: Aug 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Problem using listbox with multi selection set

Hi,

I am trying to use the Windows Forms Listbox controle in multi selection mode. When I try to read the selected values using the following code I get an array out of bounds error:

for(int i = 0; i < lst.SelectedIndices.Count; i++)
{
Debug.Writeline("value " + i + "=" + lst.SelectedIndices[i]);
}

The array out of bounds is given in the statement lst.SelectedIndices[i]. This is really strange as lst.SelectedIndices.Count does give the correct number of selected items.

Has anyone seen this behaviour before or know if it is a known bug?

Thanks in advance,

Nidkil
Reply With Quote
  #2 (permalink)  
Old 08-19-05, 03:25 PM
nidkil nidkil is offline
New Member
 
Join Date: Aug 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Additional information

I have been debugging and have found that the problem only occures when I call the mentioned code from the MouseDown event. If I place the same code under a Button it works.

Hope this helps along in finding a solution.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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 On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP upload prob minority ASP 1 06-27-05 08:35 AM
Dynamic ListBox Problem ... Plz Help me... jaishalg PHP 1 09-14-04 05:23 AM
multi selection drop down list studenteye PHP 1 07-10-04 07:20 AM
Problem with DataBase ICE Flame ASP 3 04-27-04 01:04 AM
picking random entries with a filter... Double selection problem dsumpter PHP 7 11-16-03 07:19 PM


All times are GMT -5. The time now is 02:15 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.