Reputation: 29
I have made the following code in a c# project:
private void RandAddButton_Click(object sender, EventArgs e) {
int numberOfItems = int.Parse(amountItems.Text);
CreateDataSet.CreateDataSet create = new CreateDataSet.CreateDataSet();
create.CreateItems(numberOfItems);
}
as you can see am trying to use the CreateItems in the CreateDataSet class. The problem is that i get the folowing error
'CreateDataSet.CreateDataSet' does not contain a constructor that takes 0 arguments
but in the CreateDataSet class i have the following constructor:
public CreateDataSet() {
}
Why is this not working?
Thank You
Upvotes: 0
Views: 261
Reputation: 21409
Do this:
CreateDataSet create = new CreateDataSet();
Instead of:
CreateDataSet.CreateDataSet create = new CreateDataSet.CreateDataSet();
Upvotes: 1
Reputation: 108790
Your call new CreateDataSet.CreateDataSet()
wants to create an instance of the nested class CreateDataSet.CreateDataSet
. If you want to call the constructor of CreateDataSet
you should just use new CreateDataSet()
.
Upvotes: 3