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()); } }
Loading
VulpesPosted Dec 4, 2011, 5:17 AM
Satyapriya NayakPosted Dec 4, 2011, 1:56 AM
Please refer the below link
http://stackoverflow.com/questions/8367484/hashtable-with-3-parameters
Thanks