DR00ME Posted February 23, 2004 Posted February 23, 2004 (edited) Dim R2 As NameValueCollection How do I add integer in R2 ? Edited February 24, 2004 by DR00ME Quote "Everything should be made as simple as possible, but not simpler." "It's not that I'm so smart , it's just that I stay with problems longer ." - Albert Einstein
*Experts* mutant Posted February 23, 2004 *Experts* Posted February 23, 2004 Convert the integer to a string using its ToString() method or the Convert class and its ToString method. You might want to look at a HashTable rather than nameValueCollection for anything else than strings. Quote
*Experts* mutant Posted February 23, 2004 *Experts* Posted February 23, 2004 Im not really sure if im following the code you gave me as I have no idea what its suppoded to do, but from what I see HashTable will work. HashTable is a Key/Object collection too. [edit]You just edited your post, Ill reread it :)[/edit] [edit]Ah I see now. So basically you are setting a number as key and the count as the value. HashTable is perfect for that kind of job.[/edit] Quote
DR00ME Posted February 24, 2004 Author Posted February 24, 2004 (edited) I think hashtable is not useful for my needs because it doesnt got a method to count how many times a specific key/value occurs in it or does it ? Edited February 24, 2004 by DR00ME Quote "Everything should be made as simple as possible, but not simpler." "It's not that I'm so smart , it's just that I stay with problems longer ." - Albert Einstein
*Experts* mutant Posted February 24, 2004 *Experts* Posted February 24, 2004 Same key cannot be added to a HashTable more than once. Btw. don't make converting this to a hashtable a big priority in your program. NameValueCollection accepts strings. Integers are easily converted from/to strings so that will work too. But NameValueCollection wont work for other objects which you can't really convert to string and have a good result from it. I suggested this from a habit of using collections that fit the right object. I probably misunderstood your design too, so I might be totally off here. Quote
DR00ME Posted February 24, 2004 Author Posted February 24, 2004 (edited) ok there is a bug in my (actually not mine it is quoted from heiko) code so just forget it(I have also removed the code).... only thing im just trying to find out is how to calculate how many times a specific integer appears in some thing. This thing could be array,list,collection or something. I dont want to do 2 x for loops if I use an array to find out which int occur most. Does anyone know if there is a collection/list/something which contains a method for calculating occurance ? Edited February 24, 2004 by DR00ME Quote "Everything should be made as simple as possible, but not simpler." "It's not that I'm so smart , it's just that I stay with problems longer ." - Albert Einstein
DR00ME Posted February 24, 2004 Author Posted February 24, 2004 Nevermind. Thx everyone who tried. I don't need it anymore it is too heavy for CPU I found a way to go around it. Quote "Everything should be made as simple as possible, but not simpler." "It's not that I'm so smart , it's just that I stay with problems longer ." - Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.