|
-
Nov 1st, 2002, 03:20 PM
#1
Thread Starter
Sleep mode
C# To Vb.net
HI EVERY1
I'm really wondering if there is any program that has the ability to convert VB.NET Code to C# or vice versa , like upgrading VB6 TO VB.NET
Thanx guys
-
Nov 1st, 2002, 03:32 PM
#2
Addicted Member
Re: C# To Vb.net
Originally posted by pirate
HI EVERY1
I'm really wondering if there is any program that has the ability to convert VB.NET Code to C# or vice versa , like upgrading VB6 TO VB.NET
Thanx guys
Why do you want to do that? They can interoperate.
-
Nov 1st, 2002, 04:14 PM
#3
Thread Starter
Sleep mode
Well , I know that . Sometimes I find C# CODE and want ,for example a peice of that CODE in VB.NET .
No body answered yet .
thanx
-
Nov 1st, 2002, 04:54 PM
#4
You should just learn the C# syntax and translate it yourself, I think that is what most people are doing. Its really not hard.
I'll start you off:
VB Code:
'declaring a variable in vb
Dim MyVar As Integer
'goes: [variablename] As [Type]
'now in C#
Integer MyVar;
'goes: [Type] [variablename];
'the semicolon is the line terminator in C# so just about every line has it at the end
-
Nov 1st, 2002, 05:22 PM
#5
Thread Starter
Sleep mode
Originally posted by Edneeis
You should just learn the C# syntax and translate it yourself, I think that is what most people are doing. Its really not hard.
I'll start you off:
VB Code:
'declaring a variable in vb
Dim MyVar As Integer
'goes: [variablename] As [Type]
'now in C#
Integer MyVar;
'goes: [Type] [variablename];
'the semicolon is the line terminator in C# so just about every line has it at the end
______________________________________________
thanx Edneeis .
I found a lot of sites talking about C# for beginners but hoped I can find learning "C# in comparsion to VB". Just like the way you posted it .
-
Nov 1st, 2002, 05:29 PM
#6
Thread Starter
Sleep mode
one more question
if a vb project contained 10 lines of code , then after converting to C# must be 10 lines too ?
-
Nov 1st, 2002, 06:41 PM
#7
Maybe C# sometimes has more lines but usually less words:
VB Code:
'VB line count=7
Dim item As String
For Each item In Items
If item="MyItem" Then
Msgbox("I Found It")
Exit For
End If
Next
//C# line count=7
foreach (string item in Items)
{
if (item=="MyItem")
{
MessageBox.Show("I Found It");
//I don't think C# has an Exit For command
}
}
Somethings are more lines because of the {} structure but that might be the only thing on a line. Also somethings are shorter or longer (i.e. doesn't need a seperate line in C# to declare the For item, but each Case in a Select Case needs a break; statement).
-
Nov 1st, 2002, 07:38 PM
#8
PowerPoster
Instead of exit for, it is break in C#:
VB Code:
//C# line count=7
foreach (string item in Items)
{
if (item=="MyItem")
{
MessageBox.Show("I Found It");
break;
}
}
Also, when you type break in the IDE, it will show you which loop it is breaking out of by making it bold. I think that is pretty cool.
-
Nov 1st, 2002, 07:42 PM
#9
PowerPoster
And just so you know, you have some flexibility with your coding style. C# doesn't care about white space. Since you use the ; at the end of a statement, you can seperate or compress your code to what ever you like. Example:
Code:
foreach (string item in Items){if (item=="MyItem"){MessageBox.Show("I Found It");break;}}
Doesn't look very readable though.
-
Nov 2nd, 2002, 09:14 AM
#10
yay gay
-
Nov 2nd, 2002, 11:14 AM
#11
PowerPoster
-
Nov 3rd, 2002, 01:24 PM
#12
Thread Starter
Sleep mode
thanx all for the posts .I started learning C# . BYE BYE
-
Nov 3rd, 2002, 01:27 PM
#13
yay gay
yea...2 weeks ago i started switching from vb.net to C#...although at start it looked like a mess and ugly now i got used and already preferr it to vb.net
-
Nov 3rd, 2002, 01:39 PM
#14
Thread Starter
Sleep mode
IF you have long xp in VB.NET then you swiched to C# , do you think 2 weeks enough to master both C# & VB.NET since both are similar
-
Nov 3rd, 2002, 01:45 PM
#15
PowerPoster
Not a chance in hell that you can master any language in two weeks..
-
Nov 3rd, 2002, 02:21 PM
#16
Thread Starter
Sleep mode
-
Nov 3rd, 2002, 03:41 PM
#17
yay gay
im reading a 900page book..i already had experience in vb.net so it's just a matter of sintax
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
|