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:
61
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
getting file permissions
script injection
medium trust
save way to show/hide secure data?
forms authentication and cookie not expiring
windows authentication
asp.net 1.1 sp1 and msidxs oledb provider
challenge response on external server?? domain?
password not recognized
preventing browswer from remembering password
manually advancing to the completed wizard step
clicking on buttons gave no responses. ie issue?
storing infomation in session variable is the most security ?
get authentication messages in iis but not in visual studio 2005 debugging
assigning custom roles to current user with genericprincipal
asp.net password program for netgear wireless router...
how to set password from cookie when mode of textbox is password ?
how to get username who request the web page.
setup db for membership. sql server2003?
login/forgot password/register login controls on one page?
is it possible to use email instead of username?
mixed mode authentication in asp.net 2.0
problem with custom membership provider
formsauthention login issue
membership fixed
cannot access a subdirectory
forms authorization
two questions about passwordrecovery and send email with data through html
t-sql command create a user (emulate the sqlmembershipprovider)
using ad authentication and assigning roles
any idea on how to use role matrix in asp.net 2.0?
asp.net on windows server 2003
accessing profile info for another user
urgent !!!! gpg with c#
user.isinrole
configuration error
security tab of asp.net web site admin tool, could not find stored procedure 'dbo.aspnet_checkschemaversion'.
a different kind of forms authentication question
password encryption and decryption
creating users for different clients
authentication: multiple auth types for one site
sending tasks in outlook from asp.net
validating windows credentials??
anybody could explain how is the aspnetdb.mdf generated
obtaining the windows login id from in asp.net
setting & getting profile information from a .net console app.config file
attach the aspnet_users table to other custom table, or use existing login tables
to use login controls...need sql express in addition to sql server 2005?
general security issues
asp net 1.1 security problem
Privacy
|
Contact Us
All Times Are GMT