"Does Not Contain Definition and No Extension Method Found " But Exists in another Class

550 views Asked by At

I am getting this error:

TicketingSystem' does not contain a definition for 'DVPrintDocument_PrintPage' and no extension method could be found.

I am trying to organize my code by putting it in separate classes. I made a new class called Printing.cs which has this code:

public void DVPrintDocument_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
    Bitmap r3tsLogo = Properties.Resources.rt3slogo;
    Image image1 = r3tsLogo; //image 1 is r3tsLogo
    e.Graphics.DrawImage(image1, 350, 0, image1.Width, image1.Height);

    // e.Graphics.DrawString("Employee Name:" + employee.Text, new Font("Arial", 15, FontStyle.Regular), Brushes.Black, new Point(50, 200)); //Put to bottom of paper
    e.Graphics.DrawString("Address:", new Font("Impact", 12, FontStyle.Regular), Brushes.Black, new Point(300, 90));//change the new point to put text on different part of paper.
    e.Graphics.DrawString("North Building", new Font("Arial", 10, FontStyle.Regular), Brushes.Black, new Point(370, 94)); //This line of code connects to Code line 151   
    e.Graphics.DrawString("Email:", new Font("Impact", 12, FontStyle.Regular), Brushes.Black, new Point(300, 120));//change the new point to put text on different part of paper.
    e.Graphics.DrawString("[email protected]", new Font("Arial", 10, FontStyle.Regular), Brushes.Black, new Point(350, 124)); //This line of code connects to Code line 154
    e.Graphics.DrawString("Date: " + DateTime.Now, new Font("Arial", 13, FontStyle.Regular), Brushes.Black, new Point(300, 150));
    e.Graphics.DrawString(ticketingSystem.dashes.Text, new Font("Arial", 12), Brushes.Black, new Point(0, 160));

    e.Graphics.DrawString("CUSTOMER INFORMATION:", new Font("Arial", 14, FontStyle.Regular), Brushes.Black, new Point(275, 180));
    e.Graphics.DrawString("Customer Name:" + ticketingSystem.nameTxtB.Text, new Font("Arial", 15, FontStyle.Regular), Brushes.Black, new Point(50, 200));
    e.Graphics.DrawString("Email:" + ticketingSystem.emailTxtBox.Text, new Font("Arial", 15, FontStyle.Regular), Brushes.Black, new Point(50, 230));
    e.Graphics.DrawString("Cell Number:" + ticketingSystem.cellNumberTxtB.Text, new Font("Arial", 15, FontStyle.Regular), Brushes.Black, new Point(50, 260));


    if(ticketingSystem.studentRadioB.Checked == true)
    {
        e.Graphics.DrawString("Position:" + ticketingSystem.studentRadioB.Text, new Font("Arial", 15, FontStyle.Regular), Brushes.Black, new Point(50, 290));
    }
    else if (ticketingSystem.teacherRadioB.Checked == true)
    {
        e.Graphics.DrawString("Position:" + ticketingSystem.teacherRadioB.Text, new Font("Arial", 15, FontStyle.Regular), Brushes.Black, new Point(50, 290));
    }

    e.Graphics.DrawString(ticketingSystem.dashes.Text, new Font("Arial", 12), Brushes.Black, new Point(0, 350));

    //--------------------------------------Device Information -------------------------------------------------------------------------------------
    int y = 493;

    e.Graphics.DrawString("DEVICE INFORMATION:", new Font("Arial", 14, FontStyle.Regular), Brushes.Black, new Point(286, 373));


    e.Graphics.DrawString("Device Type:" + ticketingSystem.devices.Text, new Font("Arial", 15, FontStyle.Regular), Brushes.Black, new Point(50, 403));

    if (ticketingSystem.devices.Visible == true & ticketingSystem.devices.Text == "Console")
    {
        e.Graphics.DrawString("Type of Console:" + ticketingSystem.consoleTextBox.Text, new Font("Arial", 15, FontStyle.Regular), Brushes.Black, new Point(50, 433));
    }

    if (ticketingSystem.comboBox3.Visible == true) //iphone selection box is visible then show selected model on print document
    {
        e.Graphics.DrawString("Type of Phone:" + ticketingSystem.comboBox3.Text, new Font("Arial", 15, FontStyle.Regular), Brushes.Black, new Point(50, 433));

    }


    e.Graphics.DrawString("Service Type:" + ticketingSystem.serviceDesc.Text, new Font("Arial", 15, FontStyle.Regular), Brushes.Black, new Point(50, 463));

    using (var arial15 = new Font("Arial", 15, FontStyle.Regular))
    {
        y += DrawWrapped("Price: $" + Convert.ToInt32(cPrice), arial15, new Point(50, 493), e.PageBounds.Size, e.Graphics);
    }

    using (var arial15 = new Font("Arial", 15, FontStyle.Regular))
    {
        y += DrawWrapped("Description:" + ticketingSystem.description4Repair.Text, arial15, new Point(50, y), e.PageBounds.Size, e.Graphics);
    }
}

Now when I comment everything out in my Main.cs I get the same error:

TicketingSystem' does not contain a definition for 'DVPrintDocument_PrintPage' and no extension method could be found.

All I want to do is tell my designer.cs to look for the code in Printing.cs.

0

There are 0 answers