|
-
Oct 3rd, 2004, 02:50 PM
#1
Thread Starter
New Member
Copy VB.NET source code to C# projects
Looks like this tool helps you to convert any VB.NET class into C#. There's an online and offline version, which are both free!
http://www.wimontheweb.com/ca_main.aspx
-
Oct 3rd, 2004, 11:32 PM
#2
PowerPoster
Tried it on one of the most common things:
MsgBox("Hello World")
and it doesn't work.
-
Oct 5th, 2004, 01:10 PM
#3
Well duh. msgbox is a VB6 compatability thing. So they probably ignored it. MessageBox.Show is the "proper" .NET way.
-
Oct 31st, 2004, 11:38 AM
#4
Junior Member
but most of the books stated that Msgbox(text) is command for message box
-
Oct 31st, 2004, 04:42 PM
#5
Frenzied Member
Originally posted by morpheus5
but most of the books stated that Msgbox(text) is command for message box
I guess that might be, but that's considered, well, almost depricated, or worse, inside of the VisualBasic namespace. MessageBox.Show() is "pure" .NET while MsgBox is well, certainly pure .NET, just happens it exists under the Microsoft and not System namespace.
-
Nov 1st, 2004, 11:19 PM
#6
PowerPoster
Have you guys seen most of the vb.net code that is out there? I see more vb people using msgbox than vb people that use MessageBox.Show...
I see more of the Left, Right, CInt, CString, CLong, etc... than the Substring method, or the CType method.
All of those are compaitibility, and are used quite often. If it doesn't do it right, then what is the point of trying to convert.
-
Nov 18th, 2004, 07:36 PM
#7
Addicted Member
Great tool.. some code work. 
What's wrong with this simple line in VB.NET?
VB Code:
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles MyBase.Load
Me.Text = "Version History"
End Sub
VB Code:
using System;
// Handles MyBase.Load
private void Form2_Load(System.Object sender, System.EventArgs e)
{
Me.Text = "Version History";
}
Cheers,
McoreD
-
Nov 19th, 2004, 11:43 PM
#8
Frenzied Member
Indeed. What is wrong? Is this a test or are you getting a compile-time error?
-
Nov 20th, 2004, 12:03 AM
#9
Addicted Member
I am sorry and nothing wrong with the VB.NET Code, it is the converted C#.NET Code which is wrong.
The VB.NET code was converted to Me.Text = "Version History"; which is wrong in Visual C#.
-
Nov 20th, 2004, 12:08 AM
#10
Frenzied Member
oh, ok. "Me" in VB is the same thing as "this" in C#. So change "Me.Text" to "this.Text".
-
Nov 20th, 2004, 12:15 AM
#11
Addicted Member
Originally posted by Mike Hildner
oh, ok. "Me" in VB is the same thing as "this" in C#. So change "Me.Text" to "this.Text".
thank you; 
My point was, the tool did conversions of far more advanced code:
for example:
VB Code:
private string myGetText(string strName)
{
try
{
// get the current assembly
System.Reflection.Assembly oAsm =
System.Reflection.Assembly.GetExecutingAssembly();
System.IO.Stream oStrm =
oAsm.GetManifestResourceStream(oAsm.GetName().Name + "." + strName);
// read contents of embedded file
System.IO.StreamReader oRdr = new System.IO.StreamReader(oStrm);
return oRdr.ReadToEnd();
}
catch (Exception ex)
{
throw ex;
}
}
But the tool failed to do simple VB.NET code like
VB Code:
Me.Text = "Version History"
Cheers,
McoreD
-
Nov 20th, 2004, 05:09 PM
#12
Frenzied Member
Yeah, there's a few conversion tools out there, none of which are perfect. I've played with a couple of them, but really have found no need to convert to/from VB.NET from/to C#. Snippets are easy enough to do yourself, and complete classes can just be used as is.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|