TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
upup upup
NA
1
4.9k
Multiple values in hashtable (C#)
Dec 4 2011 1:07 AM
How can I make a hashTable with three parameters? I want to store phone numbers, names and addresses using a hashTable. Phone number as the key, and the name, address as its value. But I can put two data only, phone number and name. How do I get to save a phone number, name, address in the hashTable?
Hashtable phoneBook;
public
FrmPhoneBook() { InitializeComponent(); phoneBook =
new
Hashtable(); }
public
void
addNewPhoneBook(
string
name,
string
tel,
string
add) {
string
names = name;
string
telp = tel;
string
address = add;
if
(!phoneBook.ContainsKey(telp)) { phoneBook.Add(telp, names); getDetails(); } }
public
void
getDetails() { lvDetails.Items.Clear();
foreach
(DictionaryEntry values
in
phoneBook) { lvDetails.Items.Add(values.Value.ToString()); lvDetails.Items[lvDetails.Items.Count -
1
].SubItems.Add( values.Key.ToString()); } }
Reply
Answers (
2
)
Subroutines in C#
Namespace