TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Jonah Chew
NA
1
0
Need help on compliation error.
Jun 5 2009 2:26 AM
Hello to C# experts,
I need help with this compliation error:
Cannot apply indexing with [] to an expression of type 'object'
else
{
try
{
OrderItem drinkOrder = new OrderItem("","",0,0.0m); // Referencing from a class within a package.
drinkOrder[itemCountInteger]
.quantityInteger
= int.Parse(quantityTextBox.Text);
if (
drinkOrder[itemCountInteger]
.quantityInteger != 0)
{
drinkOrder[itemCountInteger]
.drinkString
= drinkTypeComboBox.SelectedItem.ToString();
drinkOrder[itemCountInteger]
.priceDecimal
= itemPriceDecimal;
totalOrderDecimal += itemPriceDecimal
*
drinkOrder[itemCountInteger
].quantityInteger;
drinkTotalInteger +=
drinkOrder[itemCountInteger]
.quantityInteger;
clearForNextItem();
orderCompleteButton.Enabled = true;
itemCountInteger++;
}
________________________________________________________________
those i highlighted in blue are those with the blue swiggly after i place in the code for referencing those variable from a class.
My tutor told the class to try it as a challenge but after i got to this point i am stuck, not sure how to continue this.
So really need some help from C# experts to explain to me how to solve so i will be able to solve it easily in future.
Reply
Answers (
1
)
ListBox
How can I start to run a form which is stored in a table...