Jason

Jason

  • NA
  • 7
  • 0

error creating a method

Jul 31 2007 5:07 PM

Im a new programmer and have a book (SAMS) learn C# in 24 hours.

 

in making a simple sample prograam, I keep getting the same error - in fact same error for all three chunk of code: error is as follows:

Error 1 Expected class, delegate, enum, interface, or struct 

 

i get this error when trying to create a method -  here is short bkgrnd - I am using ORCA version of C# so the book may be a little diff than actual program .. but the book keeps saying to set the Main() entry point to the name of the project - but the name of the project is already there - so im thinking that because of these small differences - there is something im overlookning to make the code work properly -

here is the code that prompts the error:

public static void DrawEllipse(System.Windows.Forms.Form frn)

{

System.Drawing.Graphics objGraphics;

System.Drawing.Rectangle recDrawRectangle;

recDrawRectangle = frm.DisplayRectangle;

recDrawRectangle.Inflate(-5, -5);

objGraphics = frm.CreateGraphics();

objGraphics.Clear(System.Drawing.SystemColors.Control);

objGraphics.DrawEllipse(System.Drawing.Pens.Blue,recDrawRectangle);

objGraphics.Dispose();

}

thank you very much in advance,

 

J

 


Answers (6)