Hello ...
I am trying to make an address book with windows forms, and would like to add a birthday reminder feature.
The name, address, bithdate go into the xml file ( I think!), and I have put a combo box on the form to say yes or no to birthday reminders.
Eventually I would like to have a more sophisticated reminder sytem, but as I don't want to run before walking and because I have already tripped up, I'm just after something basic for now.
So, if the birthday reminder option is chosen and the birthdate is within a month of now I would like the name and birthdate to show in a lsitview, listbox, textbox (or whatever works really). Then, if the birthdate is after 'now', that it is removed or does not show.
I thought that I may be able to do this, but have discovered that I haven't got a clue! I have tried lots of things but this is what I am trying now:
foreach (XmlNode Node in xDoc.SelectNodes("Contacts/Person"))// searches throuh xml file
//If combo box'yes please' I want a birthday reminder selected and date Today is birthday minus thirty days so being warned a month before
if (cboBirthday.Text == "Yes please" && DateTime.FromFileTime(Convert.ToInt64(xNode.SelectSingleNode("Birthday").InnerText)) == dateTimePicker1.Value)
{
//list with name and birthdays
lstBirthday.Text = "Birthday List " + '\n' + Name + DateTime.FromFileTime(Convert.ToInt64(xNode.SelectSingleNode("Birthday").InnerText));
txtBirthday.Text = "Birthday List " + '\n' + Name + DateTime.FromFileTime(Convert.ToInt64(xNode.SelectSingleNode("Birthday").InnerText));
}
//If the date of the birthday has passed then remove it from the list
if ( DateTime.FromFileTime(Convert.ToInt64(xNode.SelectSingleNode("Birthday").InnerText)) < dateTimePicker1.Value)
{
lstBirthday.Text = contacts[lvContacts.SelectedItems[0].Index].Name = ""; //REMOVE
lstBirthday.Text = contacts[lvContacts.SelectedItems[0].Index].Birthday.; /// ???
}
As you can see, I am not even sure where I am supposed to be selecting from, the file or the list, so any help that will help clear my messed up mind will be very much appreciated.
Thank you ... John.