CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 [416] 849-8900
For everyone who is interested:
I opened a support ticket and learned, that the development team is aware of this performance issue with large multi-select ListBox.
Numeric values in ItemsData [instead of Items], should be slightly faster [~20% faster] than using Items if this is a high frequency workflow.
app = struct;
app.ListBox = uilistbox['Items', "Items" + [1:1000]];
app.ListBox.Multiselect = 'on';
app.ListBox.ItemsData = 1:1000;
tic
ItemsData = app.ListBox.ItemsData;
ReadItemsTime = toc;
tic
app.ListBox.Value = ItemsData;
WriteValueTime = toc;
disp[['Read items from the list box: ' num2str[ReadItemsTime] ' s']]
disp[['Write items to the Value variable: ' num2str[WriteValueTime] 's']]
-
Jun 6th, 2006, 08:51 AM #1
hi everybody.... i want to know how to select all the items in the listbox through code... similar to select all. i have it's equallent code in visual basic 6.0. --------------------------------- dim i as integer For i = 0 To List1.ListCount - 1 List1.Selected[i] = True Next ---------------------------------
can any one do..
-
Jun 6th, 2006, 08:56 AM #2
-
Jun 7th, 2006, 02:11 AM #3
Originally Posted by jmcilhinneyYou use the SetSelected method of the ListBox for each item.
Thaks for your reply jmcilhinney.. i have another doubt.how to make invert selection in a listbox through code?
-
Jun 7th, 2006, 02:28 AM #4
VB Code:
Me.ListBox1.BeginUpdate[]
For index As Integer = 0 To Me.ListBox1.Items.Count - 1 Step 1
Me.ListBox1.SetSelected[index, Not Me.ListBox1.GetSelected[index]]
-
Jun 7th, 2006, 05:19 AM #5
Originally Posted by jmcilhinneyVB Code:
Me.ListBox1.BeginUpdate[]
For index As Integer = 0 To Me.ListBox1.Items.Count - 1 Step 1
Me.ListBox1.SetSelected[index, Not Me.ListBox1.GetSelected[index]]
Thanks for ur reply.
Last edited by softkans; Jun 7th, 2006 at 05:23 AM.
Jonesgj
Chaps, How would I select all items in a listbox using code? I'm sure its an easy one but .... Thanks
3 40499
Armin Zingler
"Jonesgj" schrieb
How would I select all items in a listbox using code?For i As Integer = 0 To Me.ListBox1.Items.Count - 1 Me.ListBox1.SetSelected[i, True] Next -- ArminI'm sure its an easy one but ....
Herfried K. Wagner [MVP]
Hello,
"Jonesgj" schrieb:
How would I select all items in a listbox using code?Set the ListBox's 'SelectionMode' to 'MultiSimple' or 'MultiExtended', then you can use this code: \\\ Dim i As Integer For i = 0 To Me.ListBox1.Items.Count - 1 Me.ListBox1.SetSelected[i, True] Next i /// -- Herfried K. Wagner MVP · VB Classic, VB.NET
//www.mvps.org/dotnet
Jonesgj
Thanks Armin. "Armin Zingler" wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
"Jonesgj" schriebHow would I select all items in a listbox using code?For i As Integer = 0 To Me.ListBox1.Items.Count - 1 Me.ListBox1.SetSelected[i, True] Next --I'm sure its an easy one but ....
Armin
Replies have been disabled for this discussion.