Hello everyone, tell me, I have an XML file of such content
<Пользователь>Дмитрий</Пользователь> <Пол>Мужчина</Пол> <Дата> <Год>1997</Год> <Месяц>6</Месяц> <День>20</День> <Деятельность>Книги</Деятельность> </Дата> <Пользователь>Анна</Пользователь> <Пол>Женщина</Пол> <Дата> <Год>1993</Год> <Месяц>6</Месяц> <День>20</День> <Деятельность>Путешествия</Деятельность> </Дата>
I need to count the month and day, and drive them into a variable, but not just any date, but only, for example, where the month int month = read the date;
if(DateTime.Now.Month == month) { MessageBox("УРА ВСЁ РАБОТАЕТ"); }
I tried this:
int day = 0; int month = 0; XmlTextReader read = new XmlTextReader("user.xml"); while (read.Read())// но при компиляции тут ошибка { if (read.Name == "<Дата>" && read.GetAttribute("<День>") == "7") { if (month == DateTime.Now.Month && DateTime.Now.Day + 7 == day) Mess.ShowBalloonTip(2000, "Есть новое событие", "Сегодня есть событие", ToolTipIcon.Info); else MessageBox.Show("СЕГОДНЯ НЕТУ CОБЫТИЙ"); } }