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;
using System.Xml;
using System.IO;

namespace Enrolement
{
    public partial class Form1 : Form
    {

        public Form1()
        {
            InitializeComponent();

        }

        private void Form1_Load(object sender, EventArgs e)
        {
            /* This part of my code imports the data from the XML file that i created 
             * with all the module details such as Name, Semester, Prerequisite e.t.c. */

            XmlDocument xm = new XmlDocument();
            string list = "/modules/module/name"; //selects precise tag
            xm.Load(@"C:\Users\Ahmad Panezai\Desktop\info.xml"); //path where I have saved the xml file (My desktop)
            XmlNodeList Xn = xm.SelectNodes(list);
            foreach (XmlNode xNode in Xn)
            {
                listBox_ModuleList.Items.Add(xNode.InnerText);
            }

        }


        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {



        }

        private void button1_Click(object sender, EventArgs e)
        {

        }

        private void submit_button_Click(object sender, EventArgs e)
        {
            /* Writes all the user submitted information such as FirstName, Surname and Student ID
             * into a text file known as studentdetails */

            using (StreamWriter Writer = new StreamWriter(@"C:\Users\Ahmad Panezai\Desktop\studentdetails.txt"))
            {
                Writer.WriteLine(firstnametb.Text);
                Writer.WriteLine(surnametb.Text);
                Writer.WriteLine(studentidtb.Text);
            }

            /* Writes all the user submitted information such as FirstName, Surname, 
             * Student ID and Modules Selected into an XML file known as _timetable.xml */
            XmlTextWriter xwriter = new XmlTextWriter(studentidtb.Text + "_timetable" + ".xml", Encoding.Unicode); /* saves student details plus timetable by creating an individual
                                                                                                                    * file such as StudentID_timetable.xml'e.g.'w123456_timetable.xml */

            xwriter.Formatting = Formatting.Indented; //makes sure the nodes have been formatted into a more user friendly vieability
            xwriter.WriteStartDocument();
            xwriter.WriteStartElement("XMLFILE"); //creates <XMLFILE> node tag
            xwriter.WriteStartElement("FirstName"); //creates <Firstname> tag
            xwriter.WriteString(firstnametb.Text); //gets value from firstname textbox
            xwriter.WriteEndElement(); //closes tag
            xwriter.WriteStartElement("Surname"); //creates <Surname> tag
            xwriter.WriteString(surnametb.Text); //gets value from surname textbox
            xwriter.WriteEndElement();//closes tag
            xwriter.WriteStartElement("StudentID"); //creates <StudentID> tag
            xwriter.WriteString(studentidtb.Text); //gets value from studentID textbox
            xwriter.WriteEndElement();//closes tag

            /*creates string known as item which retrieves every value dropped into the module
             * picked listbox*/
            foreach (String item in listBox_ModulePicked.Items)
            {

                xwriter.WriteStartElement("ModulesSelected"); //creates <ModulesSelected> tag
                xwriter.WriteString(item); //retrieves details of modules selected
                xwriter.WriteEndElement(); //closes tag
            }

            xwriter.WriteEndElement(); //closes tag
            xwriter.WriteEndDocument(); //closes document
            xwriter.Close();

        }



        /* Creates the method that retrieves the modules that the student selects and drops
         * it into the selected modules listbox */

        private void add_c(object sender, EventArgs e)
        {
            ADD();
        }

        private void ADD()
        {
            int c = listBox_ModuleList.Items.Count - 1;

            for (int i = c; i >= 0; i--)
            {

                if (listBox_ModuleList.GetSelected(i))
                {
                    listBox_ModulePicked.Items.Add(listBox_ModuleList.Items[i]); //add selected value from module list into module picked
                    listBox_ModuleList.Items.RemoveAt(i);
                }
            }
        }

        /* Creates the method that deletes the modules that the student does not want to select anymore and drops
         * it into the modules listbox */

        private void sub_c(object sender, EventArgs e)
        {
            SUB();
        }

        private void SUB()
        {
            int d = listBox_ModulePicked.Items.Count - 1;

            for (int i = d; i >= 0; i--)
            {

                if (listBox_ModulePicked.GetSelected(i))
                {
                    listBox_ModuleList.Items.Add(listBox_ModulePicked.Items[i]); //delete selected value from module picked into module list
                    listBox_ModulePicked.Items.RemoveAt(i);
                }
            }

        }

        private void Form1_Paint(object sender, PaintEventArgs e)
        {

            Graphics g = e.Graphics;
            Font font = new Font("Verdana", 90);
            Font daysfont = new Font("Verdana", 10, FontStyle.Bold);
            Font timefont = new Font("Verdana", 9, FontStyle.Italic);
            SolidBrush fontcolor = new SolidBrush(Color.Black);
            SolidBrush lightgray = new SolidBrush(Color.LightGray);
            SolidBrush semiTransBrushAlgorithm = new SolidBrush(Color.FromArgb(153, 50, 204));
            SolidBrush semiTransBrush3d = new SolidBrush(Color.FromArgb(255, 20, 147));
            SolidBrush semiTransBrushood = new SolidBrush(Color.FromArgb(255, 127, 80));
            SolidBrush semiTransBrushoop = new SolidBrush(Color.FromArgb(222, 184, 135));
            SolidBrush semiTransBrushReqeng = new SolidBrush(Color.FromArgb(0, 250, 154));
            SolidBrush semiTransBrushAi = new SolidBrush(Color.FromArgb(255, 0, 0));
            SolidBrush semiTransBrushmobile = new SolidBrush(Color.FromArgb(160, 82, 45));
            SolidBrush semiTransBrushimageprocess = new SolidBrush(Color.FromArgb(216, 191, 216));

            Pen outline = new Pen(Color.Black, 2);
            Pen timeline = new Pen(Color.Black, 1);

            g.DrawRectangle(outline, 15, 600, 627, 280);
            g.FillRectangle(lightgray, 15, 600, 627, 280);

            g.DrawString("Monday", daysfont, fontcolor, 85, 600);
            g.DrawString("Tuesday", daysfont, fontcolor, 175, 600);
            g.DrawString("Wednesday", daysfont, fontcolor, 285, 600);
            g.DrawString("Thursday", daysfont, fontcolor, 420, 600);
            g.DrawString("Friday", daysfont, fontcolor, 530, 600);
            g.DrawString("L-Lecture", daysfont, fontcolor, 40, 860);
            g.DrawString("T-Tutorial", daysfont, fontcolor, 130, 860);

            g.DrawString("9", timefont, fontcolor, 20, 615);
            g.DrawString("10", timefont, fontcolor, 20, 640);
            g.DrawString("11", timefont, fontcolor, 20, 665);
            g.DrawString("12", timefont, fontcolor, 20, 690);
            g.DrawString("13", timefont, fontcolor, 20, 715);
            g.DrawString("14", timefont, fontcolor, 20, 740);
            g.DrawString("15", timefont, fontcolor, 20, 765);
            g.DrawString("16", timefont, fontcolor, 20, 790);
            g.DrawString("17", timefont, fontcolor, 20, 815);
            g.DrawString("18", timefont, fontcolor, 20, 840);

            g.DrawLine(timeline, 45, 623, 641, 623);
            g.DrawLine(timeline, 45, 648, 641, 648);
            g.DrawLine(timeline, 45, 673, 641, 673);
            g.DrawLine(timeline, 45, 698, 641, 698);
            g.DrawLine(timeline, 45, 723, 641, 723);
            g.DrawLine(timeline, 45, 748, 641, 748);
            g.DrawLine(timeline, 45, 773, 641, 773);
            g.DrawLine(timeline, 45, 798, 641, 798);
            g.DrawLine(timeline, 45, 823, 641, 823);
            g.DrawLine(timeline, 45, 848, 641, 848);


        }

        private void draw(object sender, EventArgs e)
        {
            DRAW();
        }

        private void DRAW()
        {
            Graphics g = e.Graphics;
            SolidBrush semiTransBrushAlgorithm = new SolidBrush(Color.FromArgb(153, 50, 204));
            SolidBrush semiTransBrush3d = new SolidBrush(Color.FromArgb(255, 20, 147));
            SolidBrush semiTransBrushood = new SolidBrush(Color.FromArgb(255, 127, 80));
            SolidBrush semiTransBrushoop = new SolidBrush(Color.FromArgb(222, 184, 135));
            SolidBrush semiTransBrushReqeng = new SolidBrush(Color.FromArgb(0, 250, 154));
            SolidBrush semiTransBrushAi = new SolidBrush(Color.FromArgb(255, 0, 0));
            SolidBrush semiTransBrushmobile = new SolidBrush(Color.FromArgb(160, 82, 45));
            SolidBrush semiTransBrushimageprocess = new SolidBrush(Color.FromArgb(216, 191, 216));

            foreach (String module in listBox_ModulePicked.Items)
            {
                if (module == "Algorithms and Data Structures")
                {
                    g.FillRectangle(semiTransBrushAlgorithm, 45, 623, 115, 52);//algorithm and data structure lecture
                    g.FillRectangle(semiTransBrushAlgorithm, 45, 673, 115, 52);//algorithm and data structure tutorial
                }
                else if (module == "3D Graphics I")
                {
                    g.FillRectangle(semiTransBrush3d, 45, 749, 115, 50);//3d lecture
                    g.FillRectangle(semiTransBrush3d, 45, 799, 115, 50);//3d tutorial
                }
                else if (module == "Object Oriented Design")
                {
                    g.FillRectangle(semiTransBrushood, 160, 623, 115, 50);//object oriented design lecture
                    g.FillRectangle(semiTransBrushood, 160, 673, 115, 50);//object oriented design tutorial
                }
                else if (module == "Object-oriented Programming")
                {
                    g.FillRectangle(semiTransBrushoop, 160, 749, 115, 50);//object oriented programming lecture
                    g.FillRectangle(semiTransBrushoop, 160, 799, 115, 50);//object oriented programming tutorial
                }
                else if (module == "Requirements Eng.")
                {
                    g.FillRectangle(semiTransBrushReqeng, 395, 623, 115, 50);//requirements engineering Lecture
                    g.FillRectangle(semiTransBrushReqeng, 395, 673, 115, 50);//requirements engineering Tutorial
                }
                else if (module == "Introduction to AI")
                {
                    g.FillRectangle(semiTransBrushAi, 395, 749, 115, 50);//ai Lecture
                    g.FillRectangle(semiTransBrushAi, 45, 623, 115, 50);//ai tutorial
                }
                else if (module == "Mobile Computing Principles")
                {
                    g.FillRectangle(semiTransBrushmobile, 45, 673, 115, 52);//mobile lecture
                    g.FillRectangle(semiTransBrushmobile, 45, 749, 115, 50);//mobile tutorial
                }
                else if (module == "Image Processing")
                {
                    g.FillRectangle(semiTransBrushimageprocess, 45, 799, 115, 50);//image process lecture
                    g.FillRectangle(semiTransBrushimageprocess, 160, 623, 115, 50);//image process lecture

                }

            }
        }
    }
}
ahmzy
Deleted Member

Can somebody please help me remove the error line under e ive been trying to figure it out for days but no progress :(

Line 211 I assume. Where is e defined such that it is in scope? Nowhere, and that's why you get the error. Why do you create that other method to handle the event? Just put the code in the event, or pass 'e' to the method.

Comments
Great sight!

Hi momerath i created the other method so that when the user selects modules from one list box to the other it can update with showing the colours on the timetable. Or else before I had it how it was but didnt work. What do you recommend i do? Could you possibly show me with my code as im such a begginer at this :(

How would i pass e to the method correctly, cos every route i seem to take seems to be wrong.

draw() looks like an event handler. What object and event is it attached to? Since it only accepts EventArgs, you don't have access to a Graphics property. So unless your event handler is malformed and should be taking something like a PaintEventArgs, you'll need to grab the Graphics object from the control itself.

{

    DRAW();
}
private void DRAW()
{
    Graphics g = e.Graphics;
    SolidBrush semiTransBrushAlgorithm = new SolidBrush(Color.FromArgb(153, 50, 204));
    SolidBrush semiTransBrush3d = new SolidBrush(Color.FromArgb(255, 20, 147));
    SolidBrush semiTransBrushood = new SolidBrush(Color.FromArgb(255, 127, 80));
    SolidBrush semiTransBrushoop = new SolidBrush(Color.FromArgb(222, 184, 135));
    SolidBrush semiTransBrushReqeng = new SolidBrush(Color.FromArgb(0, 250, 154));
    SolidBrush semiTransBrushAi = new SolidBrush(Color.FromArgb(255, 0, 0));
    SolidBrush semiTransBrushmobile = new SolidBrush(Color.FromArgb(160, 82, 45));
    SolidBrush semiTransBrushimageprocess = new SolidBrush(Color.FromArgb(216, 191, 216));
    foreach (String module in listBox_ModulePicked.Items)
    {
        if (module == "Algorithms and Data Structures")
        {
            g.FillRectangle(semiTransBrushAlgorithm, 45, 623, 115, 52);//algorithm and data structure lecture
            g.FillRectangle(semiTransBrushAlgorithm, 45, 673, 115, 52);//algorithm and data structure tutorial
        }
        else if (module == "3D Graphics I")
        {
            g.FillRectangle(semiTransBrush3d, 45, 749, 115, 50);//3d lecture
            g.FillRectangle(semiTransBrush3d, 45, 799, 115, 50);//3d tutorial
        }
        else if (module == "Object Oriented Design")
        {
            g.FillRectangle(semiTransBrushood, 160, 623, 115, 50);//object oriented design lecture
            g.FillRectangle(semiTransBrushood, 160, 673, 115, 50);//object oriented design tutorial
        }
        else if (module == "Object-oriented Programming")
        {
            g.FillRectangle(semiTransBrushoop, 160, 749, 115, 50);//object oriented programming lecture
            g.FillRectangle(semiTransBrushoop, 160, 799, 115, 50);//object oriented programming tutorial
        }
        else if (module == "Requirements Eng.")
        {
            g.FillRectangle(semiTransBrushReqeng, 395, 623, 115, 50);//requirements engineering Lecture
            g.FillRectangle(semiTransBrushReqeng, 395, 673, 115, 50);//requirements engineering Tutorial
        }
        else if (module == "Introduction to AI")
        {
            g.FillRectangle(semiTransBrushAi, 395, 749, 115, 50);//ai Lecture
            g.FillRectangle(semiTransBrushAi, 45, 623, 115, 50);//ai tutorial
        }
        else if (module == "Mobile Computing Principles")
        {
            g.FillRectangle(semiTransBrushmobile, 45, 673, 115, 52);//mobile lecture
            g.FillRectangle(semiTransBrushmobile, 45, 749, 115, 50);//mobile tutorial
        }
        else if (module == "Image Processing")
        {
            g.FillRectangle(semiTransBrushimageprocess, 45, 799, 115, 50);//image process lecture
            g.FillRectangle(semiTransBrushimageprocess, 160, 623, 115, 50);//image process lecture
        }
    }
}
} 


{

    DRAW();
}
private void DRAW()
{
    Graphics g = e.Graphics;
    SolidBrush semiTransBrushAlgorithm = new SolidBrush(Color.FromArgb(153, 50, 204));
    SolidBrush semiTransBrush3d = new SolidBrush(Color.FromArgb(255, 20, 147));
    SolidBrush semiTransBrushood = new SolidBrush(Color.FromArgb(255, 127, 80));
    SolidBrush semiTransBrushoop = new SolidBrush(Color.FromArgb(222, 184, 135));
    SolidBrush semiTransBrushReqeng = new SolidBrush(Color.FromArgb(0, 250, 154));
    SolidBrush semiTransBrushAi = new SolidBrush(Color.FromArgb(255, 0, 0));
    SolidBrush semiTransBrushmobile = new SolidBrush(Color.FromArgb(160, 82, 45));
    SolidBrush semiTransBrushimageprocess = new SolidBrush(Color.FromArgb(216, 191, 216));
    foreach (String module in listBox_ModulePicked.Items)
    {
        if (module == "Algorithms and Data Structures")
        {
            g.FillRectangle(semiTransBrushAlgorithm, 45, 623, 115, 52);//algorithm and data structure lecture
            g.FillRectangle(semiTransBrushAlgorithm, 45, 673, 115, 52);//algorithm and data structure tutorial
        }
        else if (module == "3D Graphics I")
        {
            g.FillRectangle(semiTransBrush3d, 45, 749, 115, 50);//3d lecture
            g.FillRectangle(semiTransBrush3d, 45, 799, 115, 50);//3d tutorial
        }
        else if (module == "Object Oriented Design")
        {
            g.FillRectangle(semiTransBrushood, 160, 623, 115, 50);//object oriented design lecture
            g.FillRectangle(semiTransBrushood, 160, 673, 115, 50);//object oriented design tutorial
        }
        else if (module == "Object-oriented Programming")
        {
            g.FillRectangle(semiTransBrushoop, 160, 749, 115, 50);//object oriented programming lecture
            g.FillRectangle(semiTransBrushoop, 160, 799, 115, 50);//object oriented programming tutorial
        }
        else if (module == "Requirements Eng.")
        {
            g.FillRectangle(semiTransBrushReqeng, 395, 623, 115, 50);//requirements engineering Lecture
            g.FillRectangle(semiTransBrushReqeng, 395, 673, 115, 50);//requirements engineering Tutorial
        }
        else if (module == "Introduction to AI")
        {
            g.FillRectangle(semiTransBrushAi, 395, 749, 115, 50);//ai Lecture
            g.FillRectangle(semiTransBrushAi, 45, 623, 115, 50);//ai tutorial
        }
        else if (module == "Mobile Computing Principles")
        {
            g.FillRectangle(semiTransBrushmobile, 45, 673, 115, 52);//mobile lecture
            g.FillRectangle(semiTransBrushmobile, 45, 749, 115, 50);//mobile tutorial
        }
        else if (module == "Image Processing")
        {
            g.FillRectangle(semiTransBrushimageprocess, 45, 799, 115, 50);//image process lecture
            g.FillRectangle(semiTransBrushimageprocess, 160, 623, 115, 50);//image process lecture
        }
    }
}
} 

i posted that twice. but is this right?

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;
using System.Xml;
using System.IO;

namespace Enrolement
{
    public partial class Form1 : Form
    {

        public Form1()
        {
            InitializeComponent();

        }

        private void Form1_Load(object sender, EventArgs e)
        {
            /* This part of my code imports the data from the XML file that i created 
             * with all the module details such as Name, Semester, Prerequisite e.t.c. */

            XmlDocument xm = new XmlDocument();
            string list = "/modules/module/name"; //selects precise tag
            xm.Load(@"C:\Users\Ahmad Panezai\Desktop\info.xml"); //path where I have saved the xml file (My desktop)
            XmlNodeList Xn = xm.SelectNodes(list);
            foreach (XmlNode xNode in Xn)
            {
                listBox_ModuleList.Items.Add(xNode.InnerText);
            }

        }


        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {



        }

        private void button1_Click(object sender, EventArgs e)
        {

        }

        private void submit_button_Click(object sender, EventArgs e)
        {
            /* Writes all the user submitted information such as FirstName, Surname and Student ID
             * into a text file known as studentdetails */

            using (StreamWriter Writer = new StreamWriter(@"C:\Users\Ahmad Panezai\Desktop\studentdetails.txt"))
            {
                Writer.WriteLine(firstnametb.Text);
                Writer.WriteLine(surnametb.Text);
                Writer.WriteLine(studentidtb.Text);
            }

            /* Writes all the user submitted information such as FirstName, Surname, 
             * Student ID and Modules Selected into an XML file known as _timetable.xml */
            XmlTextWriter xwriter = new XmlTextWriter(studentidtb.Text + "_timetable" + ".xml", Encoding.Unicode); /* saves student details plus timetable by creating an individual
                                                                                                                    * file such as StudentID_timetable.xml'e.g.'w123456_timetable.xml */

            xwriter.Formatting = Formatting.Indented; //makes sure the nodes have been formatted into a more user friendly vieability
            xwriter.WriteStartDocument();
            xwriter.WriteStartElement("XMLFILE"); //creates <XMLFILE> node tag
            xwriter.WriteStartElement("FirstName"); //creates <Firstname> tag
            xwriter.WriteString(firstnametb.Text); //gets value from firstname textbox
            xwriter.WriteEndElement(); //closes tag
            xwriter.WriteStartElement("Surname"); //creates <Surname> tag
            xwriter.WriteString(surnametb.Text); //gets value from surname textbox
            xwriter.WriteEndElement();//closes tag
            xwriter.WriteStartElement("StudentID"); //creates <StudentID> tag
            xwriter.WriteString(studentidtb.Text); //gets value from studentID textbox
            xwriter.WriteEndElement();//closes tag

            /*creates string known as item which retrieves every value dropped into the module
             * picked listbox*/
            foreach (String item in listBox_ModulePicked.Items)
            {

                xwriter.WriteStartElement("ModulesSelected"); //creates <ModulesSelected> tag
                xwriter.WriteString(item); //retrieves details of modules selected
                xwriter.WriteEndElement(); //closes tag
            }

            xwriter.WriteEndElement(); //closes tag
            xwriter.WriteEndDocument(); //closes document
            xwriter.Close();

        }



        /* Creates the method that retrieves the modules that the student selects and drops
         * it into the selected modules listbox */

        private void add_c(object sender, EventArgs e)
        {
            ADD();
        }

        private void ADD()
        {
            int c = listBox_ModuleList.Items.Count - 1;

            for (int i = c; i >= 0; i--)
            {

                if (listBox_ModuleList.GetSelected(i))
                {
                    listBox_ModulePicked.Items.Add(listBox_ModuleList.Items[i]); //add selected value from module list into module picked
                    listBox_ModuleList.Items.RemoveAt(i);
                }
            }
        }

        /* Creates the method that deletes the modules that the student does not want to select anymore and drops
         * it into the modules listbox */

        private void sub_c(object sender, EventArgs e)
        {
            SUB();
        }

        private void SUB()
        {
            int d = listBox_ModulePicked.Items.Count - 1;

            for (int i = d; i >= 0; i--)
            {

                if (listBox_ModulePicked.GetSelected(i))
                {
                    listBox_ModuleList.Items.Add(listBox_ModulePicked.Items[i]); //delete selected value from module picked into module list
                    listBox_ModulePicked.Items.RemoveAt(i);
                }
            }

        }

        private void Form1_Paint(object sender, PaintEventArgs e)
        {

            Graphics g = e.Graphics;
            Font font = new Font("Verdana", 90);
            Font daysfont = new Font("Verdana", 10, FontStyle.Bold);
            Font timefont = new Font("Verdana", 9, FontStyle.Italic);
            SolidBrush fontcolor = new SolidBrush(Color.Black);
            SolidBrush lightgray = new SolidBrush(Color.LightGray);
            SolidBrush semiTransBrushAlgorithm = new SolidBrush(Color.FromArgb(153, 50, 204));
            SolidBrush semiTransBrush3d = new SolidBrush(Color.FromArgb(255, 20, 147));
            SolidBrush semiTransBrushood = new SolidBrush(Color.FromArgb(255, 127, 80));
            SolidBrush semiTransBrushoop = new SolidBrush(Color.FromArgb(222, 184, 135));
            SolidBrush semiTransBrushReqeng = new SolidBrush(Color.FromArgb(0, 250, 154));
            SolidBrush semiTransBrushAi = new SolidBrush(Color.FromArgb(255, 0, 0));
            SolidBrush semiTransBrushmobile = new SolidBrush(Color.FromArgb(160, 82, 45));
            SolidBrush semiTransBrushimageprocess = new SolidBrush(Color.FromArgb(216, 191, 216));




            Pen outline = new Pen(Color.Black, 2);
            Pen timeline = new Pen(Color.Black, 1);

            g.DrawRectangle(outline, 15, 600, 627, 280);
            g.FillRectangle(lightgray, 15, 600, 627, 280);

            g.DrawString("Monday", daysfont, fontcolor, 85, 600);
            g.DrawString("Tuesday", daysfont, fontcolor, 175, 600);
            g.DrawString("Wednesday", daysfont, fontcolor, 285, 600);
            g.DrawString("Thursday", daysfont, fontcolor, 420, 600);
            g.DrawString("Friday", daysfont, fontcolor, 530, 600);
            g.DrawString("L-Lecture", daysfont, fontcolor, 40, 860);
            g.DrawString("T-Tutorial", daysfont, fontcolor, 130, 860);

            g.DrawString("9", timefont, fontcolor, 20, 615);
            g.DrawString("10", timefont, fontcolor, 20, 640);
            g.DrawString("11", timefont, fontcolor, 20, 665);
            g.DrawString("12", timefont, fontcolor, 20, 690);
            g.DrawString("13", timefont, fontcolor, 20, 715);
            g.DrawString("14", timefont, fontcolor, 20, 740);
            g.DrawString("15", timefont, fontcolor, 20, 765);
            g.DrawString("16", timefont, fontcolor, 20, 790);
            g.DrawString("17", timefont, fontcolor, 20, 815);
            g.DrawString("18", timefont, fontcolor, 20, 840);

            g.DrawLine(timeline, 45, 623, 641, 623);
            g.DrawLine(timeline, 45, 648, 641, 648);
            g.DrawLine(timeline, 45, 673, 641, 673);
            g.DrawLine(timeline, 45, 698, 641, 698);
            g.DrawLine(timeline, 45, 723, 641, 723);
            g.DrawLine(timeline, 45, 748, 641, 748);
            g.DrawLine(timeline, 45, 773, 641, 773);
            g.DrawLine(timeline, 45, 798, 641, 798);
            g.DrawLine(timeline, 45, 823, 641, 823);
            g.DrawLine(timeline, 45, 848, 641, 848);


            foreach (String module in listBox_ModulePicked.Items)
            {
                if (module == "Algorithms and Data Structures")
                {
                    g.FillRectangle(semiTransBrushAlgorithm, 45, 623, 115, 52);//algorithm and data structure lecture
                    g.FillRectangle(semiTransBrushAlgorithm, 45, 673, 115, 52);//algorithm and data structure tutorial
                }
                else if (module == "3D Graphics I")
                {
                    g.FillRectangle(semiTransBrush3d, 45, 749, 115, 50);//3d lecture
                    g.FillRectangle(semiTransBrush3d, 45, 799, 115, 50);//3d tutorial
                }
                else if (module == "Object Oriented Design")
                {
                    g.FillRectangle(semiTransBrushood, 160, 623, 115, 50);//object oriented design lecture
                    g.FillRectangle(semiTransBrushood, 160, 673, 115, 50);//object oriented design tutorial
                }
                else if (module == "Object-oriented Programming")
                {
                    g.FillRectangle(semiTransBrushoop, 160, 749, 115, 50);//object oriented programming lecture
                    g.FillRectangle(semiTransBrushoop, 160, 799, 115, 50);//object oriented programming tutorial
                }
                else if (module == "Requirements Eng.")
                {
                    g.FillRectangle(semiTransBrushReqeng, 395, 623, 115, 50);//requirements engineering Lecture
                    g.FillRectangle(semiTransBrushReqeng, 395, 673, 115, 50);//requirements engineering Tutorial
                }
                else if (module == "Introduction to AI")
                {
                    g.FillRectangle(semiTransBrushAi, 395, 749, 115, 50);//ai Lecture
                    g.FillRectangle(semiTransBrushAi, 45, 623, 115, 50);//ai tutorial
                }
                else if (module == "Mobile Computing Principles")
                {
                    g.FillRectangle(semiTransBrushmobile, 45, 673, 115, 52);//mobile lecture
                    g.FillRectangle(semiTransBrushmobile, 45, 749, 115, 50);//mobile tutorial
                }
                else if (module == "Image Processing")
                {
                    g.FillRectangle(semiTransBrushimageprocess, 45, 799, 115, 50);//image process lecture
                    g.FillRectangle(semiTransBrushimageprocess, 160, 623, 115, 50);//image process lecture

                }

            }

I have done it this way now and removed the extra method, but my only problem is that the rectangle graphics dont show up when a module is passed over to the selected module list box

that is my interface hope it makes more sense of what im saying. thanks

This question has already been answered. Start a new discussion instead.