Reputation: 343
I'm new to the forums and to coding, this is an error that I have not yet seen and as far as I can tell have enclosed my methods and classes correctly yet I am still getting the following 2 errors:
Type or namespace definition, or end-of-file expected.
namespace Assignment15Start
{
public partial class GradebookForm : Form
{
private Student betty;
public GradebookForm()
{
InitializeComponent();
}
private void addStudentButton_Click(object sender, EventArgs e)
{
betty = new Student() {Name = "Lisa", Id = 55555};
//betty.SingleCourse.AssignmentCreate();
private void Grade()
{
double grade;
grade = betty.SingleCourse.CalcGrade()*100;
MessageBox.Show("Your grade is " + grade);
}
}
}
}
Upvotes: 0
Views: 118
Reputation: 888047
You're defining the Grade()
method inside the addStudentButton_Click
method.
You can't do that; methods cannot be nested. (except for anonymous methods)
Upvotes: 1