473,507 Members | 2,377 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error in converting C# -> VB.NET

Why This conversion is impossible?!
I try to get the [Test(int val) : this()] in VB.NET but I always gor a
error...

public class Test
{
// Fields
private int _a;
private string _Name;

// Methods
public Test()
{
this._Name = "cool";
}

public Test(int val) : this()
{
this._a = val;
}

public string YourName()
{
return this._Name;
}
}
Public Class Test
' Fields
Private _a As Integer
Private _Name As String

' Methods
Public Sub New()
Me._Name = "cool"
End Sub

Public Sub New(ByVal val As Integer) : Me.New() ' <=== Here is the
problem!!! =========================
Me._a = val
End Sub

Public Function YourName() As String
Return Me._Name
End Function
End Class

____________________________
Franky

Nov 21 '05 #1
1 1002
In VB.NET, all you do is call 'MyClass.New()' as the first line of code in
the constructor - there is no special syntax like in c#.
If it there, but not the first executable statement, the compiler will
complain.

"Franky" <fr***************@hotmail.com> wrote in message
news:uu**************@TK2MSFTNGP15.phx.gbl...
Why This conversion is impossible?!
I try to get the [Test(int val) : this()] in VB.NET but I always gor a
error...

public class Test
{
// Fields
private int _a;
private string _Name;

// Methods
public Test()
{
this._Name = "cool";
}

public Test(int val) : this()
{
this._a = val;
}

public string YourName()
{
return this._Name;
}
}
Public Class Test
' Fields
Private _a As Integer
Private _Name As String

' Methods
Public Sub New()
Me._Name = "cool"
End Sub

Public Sub New(ByVal val As Integer) : Me.New() ' <=== Here is the problem!!! =========================
Me._a = val
End Sub

Public Function YourName() As String
Return Me._Name
End Function
End Class

____________________________
Franky

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
12702
by: MFA | last post by:
Hi All I am getting this error. Microsoft VBScript runtime (0x800A0006) Overflow: '' I am using if and case statments a lot, at certain point when I am just putting another case statment...
9
2665
by: Eric Lilja | last post by:
Hello, I'm a novice C++ programmer and now I have the task of converting a number of C++ functions to C. Some of the functions I'm converting takes a parameter of type reference-to-std::string...
1
1638
by: amitbadgi | last post by:
I am gettign this error while converting an asp application to asp.net , its a query syntax error, Exception Details: System.Runtime.InteropServices.COMException: Syntax error in query expression...
15
2701
by: bill salkin | last post by:
I'd like to create a custom error handler like this in VB.NET: .... try ... Throw ("Lender Name not in table") .... catch ("Lender Name not in table")
1
657
by: ken.carlino | last post by:
Hi, I have the following compile error instantiated from here, I appreciate if someone can help me find out why? g++ -O0 -g3 -Wall -c -fmessage-length=0 -ostddev.o ../stddev.cpp...
7
2679
by: Tor Aadnevik | last post by:
Hi, I have a problem converting values from Single to double. eg. When the Single value 12.19 is converted to double, the result is 12.1899995803833. Anyone know how to avoid this? Regards...
25
9540
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - Why does parseInt('09') give an error? ----------------------------------------------------------------------- ...
25
4350
by: Blasting Cap | last post by:
I keep getting errors that pop up when I am trying to convert an application from dotnet framework 1.1 to framework 2.0. The old project was saved in sourcesafe from Visual Studio 2003, and I have...
1
1493
by: ganesh22 | last post by:
Hi, Iam getting the below error while my application is running on IIS. in my application iam converting a text into word format, so i added some .dll from COM for converting word format ...
2
4426
by: Manikrag | last post by:
Hi All, I am getting error while am loading RSS Stream in XMLDocument object. The error is as follows. "System.Xml.XmlException: '', hexadecimal value 0x19, is an invalid character. Line 18,...
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7111
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7319
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7031
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7485
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
412
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.