1) 'contactIn' is a variable but is used like a method
2) No overload for method "ChangeContact" takes 1 arguments
ContactManager Class
class ContactManager
{
private List
public ContactManager()
{
m_contactRegistry = new List
}
///
/// Changes selected item
///
///
///
///
public bool ChangeContact(string str, Contact contactIn)
{
foreach (Contact c in m_contactRegistry)
{
if (c.ToString() == str)
{
m_contactRegistry = contactIn(c);
return true;
}
}
return false;
}
///
/// Edit/Change button
///
///
///
private void chgButton_Click(object sender, EventArgs e)
{
Assignment_6_attempt_1.ContactFiles.ContactManager mngr = new Assignment_6_attempt_1.ContactFiles.ContactManager();
string currContact;
try
{
currContact = listBox.SelectedItem.ToString();
bool flg = mngr.ChangeContact(currContact);
if (flg)
MessageBox.Show("Successfully Changed");
}
catch (Exception){ return; }
UpdateGUI();
Thank you >.<
Ramesh MaruthiPosted Jan 6, 2015, 8:56 PM
What is Contact is it an object Right ?
What do you have in the string str, and how your making comparison btwn an object and string ?
And yes it throws an error because contactIn is variable you cannot use it like a method and pass c parameter in it
your way :
Other Way :