473,473 Members | 1,832 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Reading Key Value from Collection in VB.NET

I have a VB.NET application that manages multiple theads.

I have created a collection to handle the threads

Dim colThreads As New Collection()

then when I create a new thread I add it to the collection
'ADD A HANDLER TO CAPTURE DATA BACK FROM THE THREAD
AddHandler cAccessFunc.ThreadDone, AddressOf RptMSAThreadDone
Dim othread1 As New Thread(AddressOf cAccessFunc.CAccessSnapShot)
cFunctions.WriteEventLog("Add thread to collection : " &
CStr(arThreadCnts(1, c)))
' SET THE PROPERTIES OF THE CLASS AND START NEW THREAD
othread1.Name = CStr(arThreadCnts(1, c))
colThreads.Add(othread1, RTrim(CStr(arThreadCnts(1, c))))
.......

The value in arThreadCnts(1, c) is a unique string
When I try to read the from the collection to check on a thread I and
doing this:

cFunctions.WriteEventLog("ThreadName: " & CStr(pThreadName) & " col
thread name:" & colThreads.Item(CStr(pThreadName)).tostring)
If colThreads.Item(d).ToString = RTrim(CStr(pThreadName)) Then
Dim aThread As Thread = colThreads.Item(CStr(pThreadName))
aThreadState = aThread.ThreadState.ToString
cFunctions.WriteEventLog(Thread state: " & CStr(aThreadState))
If aThread.ThreadState = ThreadState.Running Then
aThread.Abort()
colThreads.Remove(RTrim(CStr(pThreadName)))
cFunctions.WriteEventLog(Thread removed: " &
CStr(pThreadName))
End If
End If
When I view the event log I get col thread
name:System.Threading.Thread

Does anyone see what I am doing wrong? Why I do not get a Key set for
each item I am adding to the colletion?
Nov 20 '05 #1
1 12612
Hi Steven,

One of the things I do not like from the old VB are the collections. I have
done this the same as you however changed it to a ArrayList with an index
where I have given every thread an number.

When you want it on another way I would look at the hashtable for this.

http://msdn.microsoft.com/library/de...classtopic.asp

I hope this helps?

Cor
Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: huzz | last post by:
How can i access arraylist value as (int) i want access value of the index 4 of the arraylist shown below. Any suggestions? Permissions {Length=8} : {1} : {1} : "Awlad Hussain"
4
by: Mateo | last post by:
Hi! I have labels on my page (some are web forms controls, and some are plain HTML labels), and I need Mozilla compatibile way for reading label value. For example, in IE I can use this:...
2
by: Cantekin Guneser | last post by:
in my program when a button clicked , a process starts, but i need to take two value, becouse of this, i use a new windows form, to make my program more userfriendly, i was thinking is it possible...
2
by: npverni | last post by:
I have a string with name value collections (i.e. &foo=1&foo2=2) Can I convert this string to some kind of name/value collection so I can access the values with something like : params = 1; ...
0
by: Greg | last post by:
There appears to be an issue with one of the values I send to a remote server in a name value collection. if it is over 600, I get the expected result, if under I get an error returned from the...
23
by: illegal.prime | last post by:
Hi all, is there a key value collection in .Net that maintains the ordering in which I add items. I'm finding that I'm creating a number of classes that contain a name and then some object. I...
0
by: Nathaniel | last post by:
I play an online game application (Absolute poker) that displays how many points I have earned. I want the number of points I have earned to appear as a string in a text box in the program I am...
7
by: gene kelley | last post by:
I have an application where I need to read some header information found in 3 different types of file types. Two of the file types were fairly straight forward as the items to read in the header...
6
by: Melih Onvural | last post by:
I need to execute some javascript and then read the value as part of a program that I am writing. I am currently doing something like this: import htmllib, urllib, formatter class...
2
by: shimant | last post by:
Hi, I have written the following piece of code: <html> <head> </head>
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.