I'm new in this Discusion Community and C#, I have an error of which was long answered but I can't seem to find it because I'm not farmiliar with this forum.

Anyway my error: The type or namespace name 'StoreItem' could not be found (are you missing a using directive or an assembly reference?) I'm using Microsoft Visual Studio 2008 to practise and here is my code on the first class

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ElectronicStore1
    public class SaleItem
        double DiscountAmount;
        double NetPrice;
        int Quantity;
        double SaleTotal;

        public double GetDiscountRate()
        "Discount Applied (Enter 0 to 100, 0 if no discount): ");
            double discount = double.Parse(Console.ReadLine());
            return discount;

        public int GetQuantity()
            Console.Write("Enter Quantity: ");
            int q = int.Parse(Console.ReadLine());
            return q;

        public StoreItem Create()
            long itemNumber;
            char category;
            string make;
            string model;
            double discount;
            double price;
            StoreItem saleItem = new StoreItem();

            Console.Write("Enter the Item #: ");
            itemNumber = long.Parse(Console.ReadLine());
            Console.WriteLine("A - Audio Cables");
            Console.WriteLine("B - Instructional and Tutorials (Books)");
            Console.WriteLine("C - Cell Phones and Accessories");
            Console.WriteLine("D - Bags and Cases");
            Console.WriteLine("E - Headphones");
            Console.WriteLine("F - Instructional and Tutorials (VHS & DVD)");
            Console.WriteLine("G - Digital Cameras");
            Console.WriteLine("H - Cables and Connectors");
            Console.WriteLine("I - PDAs and Accessories");
            Console.WriteLine("J - Telephones and Accessories");
            Console.WriteLine("K - Surge Protector");
            Console.WriteLine("L - TVs and Videos");
            Console.WriteLine("U - Unknown");
            Console.Write("Your Choice? ");
            category = char.Parse(Console.ReadLine());
            Console.Write("Make:        ");
            make = Console.ReadLine();
            Console.Write("Model:       ");
            model = Console.ReadLine();
            Console.Write("Unit Price:  ");
            price = double.Parse(Console.ReadLine());


            return saleItem;

here is my code on the second class or Program class

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ElectronicStore1


 public class Program

        static void Main(string[] args)
            StoreItem item = new StoreItem();
            SaleItem sale = new SaleItem();
            string strTitle1 = "=-= Nearson Electonics =-=\n";
            string strTitle2 = "******* Store Items ******";


            item = sale.Create();



Thanks guys any help we be appriciated. :'(

You dont have a StoreItem class. Youare trying to instantiate an object from a class that doesnt exist.

Did you write a class and not include it here? If not, how does a StoreItem differ a SaleItem?

This article has been dead for over six months. Start a new discussion instead.