CodeVerge.Net
Beta
Item Entry
Register
Login
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums
Can Reply:
No
Members Can Edit:
No
Online:
Yes
Zone:
>
Asp.Net Forum
>
general_asp.net.getting_started
Tags:
Item Type:
Date Entered:
1/18/2005 9:41:59 AM
Date Modified:
Subscribers:
0
Subscribe Alert
Rate It:
NR
XPoints:
N/A
Replies:
1
Views:
57
Favorited:
0
Favorite
2 Items, 1 Pages
Sort By
Date Dsc
Date Asc
Votes Dsc
Votes Asc
1
|<
<<
Go
>>
>|
"setherial" <>
NewsGroup User
how to itterate trough a hashtable and change values
1/18/2005 9:41:59 AM
0
Hey Guys
I'm a first time poster and fairly new to .NET, though I'm an experienced programmer (java, perl, C++). I'm writing a small application in VB.NET and I wanted to loop trough a Hashtable and while looping trough the keys change values.
Some example code
Dim myHash As Hashtable = New Hashtable
myHash.Add("key1", "value1")
myHash.Add("key2", "value2")
myHash.Add("key3", "value3")
Dim en As IDictionaryEnumerator = myHash.GetEnumerator
While (en.MoveNext)
myHash(en.Key) = "changed"
End While
Now this throws the exception that the collection was modified while looping trough it. Which is true ofcourse. The problem is that I can't just itterate through the keys only, the collection contains both keys and values even if I use myHash.Keys.GetEnumerator it still won't work.
So my question is how to loop through the key values only of this collection so that the compiler doesn't object to changing values ?
regards
Seth
"longhorn2005"
NewsGroup User
Re: how to itterate trough a hashtable and change values
1/18/2005 1:04:41 PM
0
Hi Seth,
Welcome to
asp.net
Message forums..
Try this link
Tips and Tricks
Hope this helps
Sunny NAGI
Proper Preparation Prevents Poor Performance
Dont forget to click "Mark as Answer" on the post that helped you.
2 Items, 1 Pages
Sort By
Date Dsc
Date Asc
Votes Dsc
Votes Asc
1
|<
<<
Go
>>
>|
Free Download:
Invite
Members
SiteMap
referencing a hidden field
dynamic table
i have an urge to give the pirate yell
read file in remote machine, but access denied. why??
including a .html file inside the aspx file
database connectivity
asp with dreamweaver
stored procedure: help!
doubt on asp.net and asp or php???
please help! - read web file as binary
displaying first n characters
session variables
synchronous tcpclient not receiving complete data
components type flow diagramming
re: classified ad code
barcode generation with img controls
problem with onkeypress and the enter key
moving through the recordset
is there anything like cfdump in asp.net 2.0
error 1564: 'x:class' cannot be used when the markup is executed directly without creating a new activity type.
how many users can be create with usercreatewizard and they can login in with login ? :)
getting started with databases.
convert an asp.net project tu project.exe
best way to confirm delete?
dynamically creating flash object .net vb
parameter query to datagrid
asp.net web server is not running
accessing different dll versions
connecting create user wizard
server generated file
page_load(object sender, eventargs e)
data binder eval question.. need answer asap please.. ? ? ? [:s]
system.windows.forms in asp.net pages
viewing internal .net class code
index - error message
viewstate variables
ajax autocomplete not working on our web server
can't find classes in namespace
best way to copy a page?
help creating a glossary
video stream with asp.net
sqltable profileprovider question
into "page_load": how to call ddl into a datagrid
email
how would you manipulate text from an textbox without using string methods?
newbie-querystring or session ??
errror: invalid attempt to fieldcount when reader is closed
product help
unable to parse query text.
handles part of button click gets lost
Privacy
|
Contact Us
All Times Are GMT