Click here to Skip to main content
14,384,957 members
Rate this:
Please Sign up or sign in to vote.
See more:
The following is the code that i have. On debugging it shows two errors:
Bytescout.spreadsheet is a 'namespace'; but is used like a 'type'.

The following is the code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Bytescout.Spreadsheet.Demo.Csharp.ExportTo2DArray
    class Program
        static void Main(string[] args)
            const string inputFile = @"data.xls";

            // Open and load spreadsheet
            Spreadsheet spreadsheet = new Spreadsheet(); //**error in this line

            // Get the data from the spreadsheet
            string[,] data = spreadsheet.ExportTo2DArray();

            // Close spreadsheet

            // Display data in data table
            for (int i = 0; i < data.GetLength(0); i++)
                for (int j = 0; j < data.GetLength(1); j++)
                    Console.Write(data[i, j] + " ");

            // Pause
Updated 17-Jan-16 23:10pm
Kornfeld Eliyahu Peter 18-Jan-16 4:04am
The compiler identify Spreadsheet as namespace because of this - namespace Bytescout.Spreadsheet.Demo.Csharp.ExportTo2DArray...
What Spreadsheet did you meant?
Richard MacCutchan 18-Jan-16 5:16am
Just change your namespace to something more sensible, and different from the type names you are trying to use in the program.

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 2

Since you paid a lot of money to license this commercial product, and your code here is directly copied from their web-site [^], why don't you submit a support ticket ? If you are using a "trial" version, is it possible the trial has expired ?

The most common cause of the kind of error you report would be that you do not have a proper reference set to a necessary dll. In Visual Studio Solutions Explorer open 'References and examine what is there; if necessary select 'Add Reference from its context menu and do the right thing to find the required dll.

Try putting this in the 'using statements:

using ByteCount;

And see if that compiles.
Kornfeld Eliyahu Peter 18-Jan-16 5:31am
The really nice thing that for a starting price of $500 one should expect working samples...That code on the site does not work at all - and you do not need a compile to tell that...
BillWoodruff 18-Jan-16 11:46am
The syntax definitely makes you wonder, but keeping in mind that .NET will give you enough rope to hang yourself and compile this:

namespace YourFamily.YourMother.YourFather.YourSiblings.AllTheRelatives

You gotta consider the potential the code might work in spite of ...
Member 12247039 18-Jan-16 6:12am
Yes i did copy the code. But the code gave errors. So i posted it here.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100