Nov 30, 2015 05:59 AM
(This post was last modified: Dec 3, 2015 04:13 AM by Mr. Money™.)
Well i want to create a new thread for each listbox item how can i do this correctly?
|
.NET
Thread for each listbox item. Need help asap! [UNSOLVED] |
|
Nov 30, 2015 05:59 AM
(This post was last modified: Dec 3, 2015 04:13 AM by Mr. Money™.)
Well i want to create a new thread for each listbox item how can i do this correctly?
Code Dim dictThread as new Dictionary(of String, Thread)Create a dictionary, change i integer to the amount of listbox items. Code For Each t as Thread in dictThread.ValuesAnd start them. (Nov 30, 2015 06:19 AM)thegodhello Wrote: Create a dictionary, change i integer to the amount of listbox items. Or just cast them to whatever type, loop through each and pass as object to whatever method.
Nov 30, 2015 07:08 AM
(This post was last modified: Dec 1, 2015 03:34 AM by Mr. Money™.)
Hmm thanks for this i will go read this code couple of times to fully understand it :)
For more info about help i need check my other thread. https://hackforums.net/showthread.php?tid=5077076 Still needing help though!
Dec 1, 2015 10:06 AM
(This post was last modified: Dec 1, 2015 10:09 AM by Mr. Money™.)
Still need help with this!
Check the thread link i provided in my previous reply for more info! (Dec 1, 2015 10:06 AM)Mr. Money™ Wrote: Still need help with this! Replied to your private message. 🤝
Dec 1, 2015 11:14 AM
(This post was last modified: Dec 1, 2015 11:32 AM by Mr. Money™.)
I will try what you guys pmed me haha thanks for the help so far will update if it works or nah!
edit: Luxe i pmed you back regarding your pm. Update: This is the code i use to get each list item in a seperate thread. But this code sends only the first listbox item through multiple threads what did i wrong? Code try
Now it starting to work but is opening 1000s of threads for first listbox item. Any idea how to fix that?
Code For i As Integer = 0 To ListBox1.Items.Count()
Dec 3, 2015 02:36 AM
(This post was last modified: Dec 3, 2015 02:38 AM by Jackie Chun.)
Put For Each Item outside the dictThread, you're adding a new thread For the entire Listbox count. I think you need to define the structure in which you are using which is the Items in the listbox not the count.
Code For Each item In ListBox1.Itemsshouldnt this work?
Dec 3, 2015 04:03 AM
(This post was last modified: Dec 3, 2015 04:06 AM by Mr. Money™.)
(Dec 3, 2015 02:36 AM)Jackie Chun Wrote: Put For Each Item outside the dictThread, you're adding a new thread For the entire Listbox count. I think you need to define the structure in which you are using which is the Items in the listbox not the count. no, now it gives error that there is a item with the same key with its given name. Any idea how to solve it? Code Dim dictThread As New Dictionary(Of String, Thread)
Dec 3, 2015 12:17 PM
(This post was last modified: Dec 3, 2015 12:37 PM by poopGod.)
(Dec 3, 2015 04:03 AM)Mr. Money™ Wrote: no, now it gives error that there is a item with the same key with its given name. Any idea how to solve it?You want to start the thread before it is even added to the dictionary. Put the "dictThread(i).Start()" outside of the nested sub. And why put 2 for loops in each other? You only need 1 of those... And you dont have to explicitly call .ToString on an Integer in VB.net. EDIT: Just do this: Code Dim dicTrd As New Dictionary(Of String, Thread) |
|
|
| Possibly Related Threads... | |||
| Thread / Author | Replies | Views | Last Post |
| [.NET] by Mr. Money™Jun 29, 2017 07:41 AM | 17 | 463 |
Jun 29, 2017 07:41 AM Last Post: Mr. Money™ |
| [C#] by matty45Apr 13, 2017 01:15 PM | 9 | 473 |
Apr 13, 2017 01:15 PM Last Post: Dan Siebels |
| [C#] by blondedude092Feb 7, 2016 04:48 AM | 7 | 232 |
Feb 7, 2016 04:48 AM Last Post: hackpet |