-2

I'm working with an alarm app using C#.

Firstly, I have a Form named AddReminder.cs which take Year, Month, Day, Hour, Min and some description about what to do in that time. If I click a button named Add Reminder then it all information will save in database/pc. It will be able to add many reminder as I want.

Then I have another form named MyReminder.cs which will match the times from database/pc and give me message and a alarm. I want to say, while the pc time will be exactly the saved or reminder time then this form will be executed.

Now My questions are:

  1. How can I save multiple reminder in database or pc?
  2. How MyReminder.cs will compare with those datas and execute with alarm?

I'm working in Windows and using VS2012. And over sure it's not the duplicate of this.

This is AddReminder Design Form. And the Code

Community
  • 1
  • 1

1 Answers1

0

best way to get the date from user is a control called dateTimePicker you can use it to get the input from user and very easily save it as a datetime variable also the database supports the datatime variable type so u can easily insert it with an sql insert query

about how to know it's the alarm time ...there is a type of variable called timespan it can get the of subtraction or the diffrence bettwen 2 dates ...use this type with an if statment ... if timespan = 0 then it's time

i know i didn't explan well but if u didn't get it i can show u some code

  • Have you implement before? If you implement please give me some direction. It's imergency. – Lutfor Rahman Sep 21 '15 at 08:00
  • drag a dateTimePicker control from the control box and put it in your form you can store the date that the user select from the datetimepicker in a DateTime variable like that DateTime user = dateTimePicker.Value; create a timer with interval 1000 and in the timer tick eventhanlder declare a datatime variable which will represent the time now .. u can do it like this DataTime timenow = DateTime.Now; and you put it in a timer so the time is updated every second now we have two DateTime variables (the user selected time and time now ) you can substract them like that TimeSpan=user-timenow; – Mostafa Mohamed Ahmed Sep 22 '15 at 13:02
  • after that create an if statment if (user==timenow) {MessageBox.Show("Time up");} and for the count down you should also put the next line in the timer tick event label1.Text = diffrence.ToString(); //diffrence is the time span variable name forgot to write it up there sorry hope that's helped – Mostafa Mohamed Ahmed Sep 22 '15 at 13:07