developing a dynamic class timetable

Oct 30 2010 10:50 AM

please i want someone to help me out here. i am trying to develop a dynamic class timetable.
Every 2hrs; classes changes lectures and lecturerers. i want my application on its own to be able
to switch to next period, on the process, the next period lectures and the lectureers would display
on the thesame labels that previous lectures displayed. i am using "System.Windows.Forms.Timer" and
"TimerEventProcessor" to trigger the methods that will display the ongoing lectures and the lecturerers.
After so many efforts i made; nothing seemed to happen.
please i need help.
 
 

 using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplicationtimer
{
    public partial class Form1 : Form
    {
       // fixed time for lectures and thier respective lecturerers to display
        string timethen = "9:08:00 PM";
        string timethen2 = "7:08:01 PM";
        string timethen3 = "7:08:02 PM";
        string newtime = Convert.ToString(System.DateTime.Now);
        static System.Windows.Forms.Timer theTimer =
         new System.Windows.Forms.Timer();
        static int alarmCounter = 1;
        static bool exitFlag = false;
        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
        }
        private void TimerEventProcessor(Object myObject,
          EventArgs myEventArgs)
        {
            // calling these methods every seconds
                alarmCounter += 1;
                theTimer.Enabled = true;
                repitdisplay();
                repitdisplay2();
           
                exitFlag = true;
           
        }
        private void button1_Click(object sender, EventArgs e)
        {
           
            theTimer.Tick += new EventHandler(TimerEventProcessor);
           
            theTimer.Interval = 100;
            theTimer.Start();
            // Runs the timer, and raises the event
            while (exitFlag == false)
            {
                // Processes all the events in the queue
                Application.DoEvents();
            }
           
        }
        void repitdisplay()
        {
            label2.Text = DateTime.Now.ToLongTimeString();
            if ((string.Compare(timethen, newtime) == 0) || (string.Compare(timethen3, newtime) == 0) || (string.Compare(timethen2, newtime) == 0))
            {
               // possibly to be called from the database
                string disp = "Cos201";
               string disp1 = "Cos401";
                label1.Text = disp.ToString();
                label4.Text = disp1.ToString();
            }
        }
        void repitdisplay2()
        {
            if ((string.Compare(timethen, newtime) != 0) || (string.Compare(timethen3, newtime) != 0) || (string.Compare(timethen2, newtime) != 0))
            {
                // possibly to be called from the database
                string disp = "Mth 321";
               string disp1 = "Stat 432";
                label1.Text = disp.ToString();
                label4.Text = disp1.ToString();
            }
        }

Answers (1)