Click here to Skip to main content
15,890,336 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
I want to add values in hash table row wise.
i have 3 textboxes .i want to add textbox value in hash table row wise like,

i want my hashtable should look like this:

1 10 100 --------------row1

2 20 200 --------------row2

3 30 300 --------------row3
Posted
Updated 22-Mar-18 14:50pm
v7
Comments
[no name] 2-Jul-12 11:03am    
And your question is what? How to add values?
DamithSL 2-Jul-12 11:08am    
how you display data? using gridview or any other way?
lewax00 2-Jul-12 11:24am    
Unless you have to target .Net 1.1, you really should look into using a Dictionary, it's much easier than trying to use a Hashtable.
Sergey Alexandrovich Kryukov 2-Jul-12 11:30am    
Right. Non-generic non-specialized collections and their interfaces can be considered as obsolete since v.2.0, maintained only for compatibility with legacy code. As there is nothing wring with them, they are not marked with Obsolete attribute, but using them in new development makes no sense.
--SA
Sergey Alexandrovich Kryukov 2-Jul-12 11:27am    
Go ahead, you have my approval.
--SA

1 solution

C#
// Creates and initializes a new Hashtable.
      Hashtable myTxtHT = new Hashtable();
      myTxtHT.Add( "10", "100" );//for the first text box
      myTxtHT.Add( "20", "200" );//for the second text box
      myTxtHT.Add( "30", "300" );//for the third text box


mark as solution,if it answer your question
 
Share this answer
 
v2
Comments
Shemeer NS 2-Jul-12 14:41pm    
why down-voted, please tell me
Shemeer NS 9-Jul-12 9:28am    
It would be nice If some one can tell the reason forthis downvotes....
monoManCP 22-Mar-18 20:51pm    
what is the benefit of using Hashtable ,Is it only returning items using user defined key names?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900