Error message when you compile a project that you converted from Visual J++ to Visual C# .NET or Visual C# 2005 by using the Java language conversion assistant: "No Overload for Method 'TextBox'" (821320)
The information in this article applies to:
- Microsoft Visual C# 2005, Express Edition
- Microsoft Visual C# .NET (2003)
- Microsoft Visual J++ 1.0
SYMPTOMSWhen you convert a Visual J++ project to a Visual C# .NET
or a Visual C# 2005 project by using Java Language Conversion Assistant (JLCA), and then you compile the generated Visual C# .NET project or the generated Visual C# 2005 project, you may receive one of the
following error messages: No overload for method 'TextBox' takes '1' arguments
-or- No overload for method 'TextBox'
takes '2' arguments This error occurs only when the Visual J++
project contains a java.awt.TextField derived class and you have used any one of the following java.awt.TextField constructors in the derived class constructor:
- TextField(String text)
- TextField(int columns)
- TextField(String text, int columns)
CAUSEIn Visual C# .NET or Visual C# 2005, the System.Windows.Forms.TextBox class supports only the TextBox constructor. This constructor has no parameters. However, in Visual J++, the java.awt.TextField class supports the following four constructors:
- TextField
- TextField(int columns)
- TextField(String text)
- TextField(String text, int columns)
When you convert your project from Visual J++ to Visual C# .NET or Visual C# 2005, JLCA converts any TextField constructor to a TextBox constructor. However, because the TextBox constructor does not use parameters, you receive the compilation error message. RESOLUTIONTo resolve this problem, remove the parameters from the
constructor of the base class base in the Visual C# .NET or Visual C# 2005 code that JLCA generates, as in the following sample code: public TextFieldEx():base()
{
}
public TextFieldEx(System.String text):base()
{
this.Text = text;
}
public TextFieldEx(int noOfColumns):base()
{
}
public TextFieldEx(System.String text, int noOfColumns):base()
{
this.Text = text;
} STATUS This
behavior is by design.REFERENCESFor more information about JLCA, visit the following Microsoft Web site:
Modification Type: | Major | Last Reviewed: | 1/18/2006 |
---|
Keywords: | kbwizard kbWindowsForms kbCodeGen kbconvert kbCompiler kbJava kbprb KB821320 kbAudDeveloper |
---|
|