compiler error

  • Thread starter Thread starter CJ
  • Start date Start date
C

CJ

Can someone tell me what this error means and how to get rid of it.

ADODB.Stream adodbstream = new ADODB.Stream();
adodbstream.Type = ADODB.StreamTypeEnum.adTypeText;
adodbstream.Charset = "US-ASCII";
adodbstream.Open();
Error 1 No overload for method 'Open' takes '0' arguments
C:\Projects\Form1.cs 36 13 FormNew


Thanks
 
Can someone tell me what this error means and how to get rid of it.

ADODB.Stream adodbstream = new ADODB.Stream();
adodbstream.Type = ADODB.StreamTypeEnum.adTypeText;
adodbstream.Charset = "US-ASCII";
adodbstream.Open();
Error 1 No overload for method 'Open' takes '0' arguments
C:\Projects\Form1.cs 36 13 FormNew

It means that no overload for the method named "Open" takes no arguments..
If the class hasn't declared an overload for the method with no arguments,
then you cannot call it without arguments.

To fix it, figure out what version of the method you _do_ want to use, and
pass the appropriate arguments.

Pete
 
adodbstream.Open();
Error 1 No overload for method 'Open' takes '0' arguments

It means you cannot call Open(...) without anything in place of the '...'.
 
CJ said:
Can someone tell me what this error means and how to get rid of it.

ADODB.Stream adodbstream = new ADODB.Stream();
adodbstream.Type = ADODB.StreamTypeEnum.adTypeText;
adodbstream.Charset = "US-ASCII";
adodbstream.Open();
Error 1 No overload for method 'Open' takes '0' arguments
C:\Projects\Form1.cs 36 13 FormNew

Other have already told you that you are missing some arguments.

C# and VBS behave a bit different regarding missing arguments.

I has this piece of VBS:

Set stm = CreateObject("ADODB.Stream")
stm.Open
stm.Position = 0
stm.Charset = "UTF-8"
stm.WriteText "ABCÆØÅ"
stm.SaveToFile "C:\utf8.txt"
stm.Close

to do the same in C# I had to:

using System;

namespace E
{
public class Program
{
public static void Main(string[] args)
{
ADODB.Stream stm = new ADODB.Stream();
stm.Open(Type.Missing, ADODB.ConnectModeEnum.adModeUnknown,
ADODB.StreamOpenOptionsEnum.adOpenStreamUnspecified, "", "");
stm.Position = 0;
stm.Charset = "UTF-8";
stm.WriteText("ABCÆØÅ", ADODB.StreamWriteEnum.adWriteChar);
stm.SaveToFile(@"C:\utf8.txt",
ADODB.SaveOptionsEnum.adSaveCreateNotExist);
stm.Close();
}
}
}

You need to do something similar.

Or use something else than ADODB.Stream - I find it hard to
belive that you can not achieve what you want by using the
..NET library.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top