I've been reading up on this error message I keep getting and it seems people on other forums know it as a "beginners error". So I apologise in advance. Ive written code that will allow me to populate a combo box, but I havent had a chance to test it because I keep getting the following error "must declare a body because it is not marked abstract, external or partial. The error didnt appear until I tried to run it and I dont know either what it means or how to get rid of it!! I'll post my code below and highlight the line the error appears on....
private void cmbexamboard_SelectedIndexChanged(object sender, EventArgs e);
{
class Qualifications
{
public string Type { get; set; }
}
List qualificationslist = new List()
{
new Qualifications(){Type = "GCE"},
new Qualifications(){Type = "A-Level"},
};
}
Thanks in advance Kate
VulpesPosted Apr 13, 2013, 11:59 AM
A method needs to be followed by a block i.e. a series of statements (possibly none or one) contained within a pair of curly braces.
At the moment you have a nested class, Qualifications, declared in there which isn't allowed within methods.
You also have a List
So what you need is:
public class NSTasks : Form
{
public NSTasks()
{
InitializeComponent();
}
private void cmbexamboard_SelectedIndexChanged (object sender, EventArgs e)
{
// To Do : add some code in here
}
class Qualifications
{
public string Type { get; set; }
}
List
{
new Qualifications(){Type = "GCE"},
new Qualifications(){Type = "A-Level"},
};
}
Katie BPosted Apr 13, 2013, 9:06 AM
VulpesPosted Apr 13, 2013, 8:52 AM
private void cmbexamboard_SelectedIndexChanged(object sender, EventArgs e);