G
Guest
Good day.
I am a student working on one of my last programs for class and have come up
with an interesting problem. I have created a custom class method to handle
some calculations for my program. Usually, the created constructor is called
and used in only one method. Now I am trying to use objectName in more than
one instance. Unfortunately, every time the program compiles the error "Type
or namespace name 'x' could not be found..." appears for every subsequent
instance after the first.
The piece of code reads:
private void Form1_Load(object sender, System.EventArgs e)
{
Order newOrder = new Order( );
for (int i = 0; i < newOrder.menuBags.Length; i++)
{
this.lstBoxBagType.Items.Add(newOrder.menuBags);
}
}
private void lstBoxBagType_SelectedIndexChanged(object sender,
System.EventArgs e)
{
newOrder.Bags = this.lstBoxBagType.Text;
}
More instances are referenced throughout the remainder of the program.
I have tried moving the statement into the Main( ) and into other locations.
I have tried commenting out my loop. Nothing seems to get the constructor
passed down correctly. I am out of ideas to try to repair this process.
A point in the right direction would be greatly appreciated.
Thanks,
J
I am a student working on one of my last programs for class and have come up
with an interesting problem. I have created a custom class method to handle
some calculations for my program. Usually, the created constructor is called
and used in only one method. Now I am trying to use objectName in more than
one instance. Unfortunately, every time the program compiles the error "Type
or namespace name 'x' could not be found..." appears for every subsequent
instance after the first.
The piece of code reads:
private void Form1_Load(object sender, System.EventArgs e)
{
Order newOrder = new Order( );
for (int i = 0; i < newOrder.menuBags.Length; i++)
{
this.lstBoxBagType.Items.Add(newOrder.menuBags);
}
}
private void lstBoxBagType_SelectedIndexChanged(object sender,
System.EventArgs e)
{
newOrder.Bags = this.lstBoxBagType.Text;
}
More instances are referenced throughout the remainder of the program.
I have tried moving the statement into the Main( ) and into other locations.
I have tried commenting out my loop. Nothing seems to get the constructor
passed down correctly. I am out of ideas to try to repair this process.
A point in the right direction would be greatly appreciated.
Thanks,
J