473,804 Members | 3,043 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Converting Vb.net to C# issues

I'm learning C# by converting a large asp.net project to C# that was written
in vb.net and option strict was turned off so it's a nice challenge and it
is really teaching me C#.

This project used a lot of methods in the VisualBasic Namespace. These
methods are really valuable and it seems they might be the reason some say
VB.Net is more productive that C# albeit less safe with option strict turned
off.

My question is: Is there any docs, anywhere, that map C# methods that are
the counterpart of methods in the visualbasic namespace? I have already
found that the String class has a lot of them but there are date functions
and other things where a good map would come in handy.

Thanks,
T
May 21 '06 #1
11 1416
Tina,

There isn't always a one-to-one mapping of the functions that are native
VB as opposed to what is typically exposed in C#.

I don't know of such a document, but if you post the methods here that
you are having trouble with, I'm sure we can pose alternatives.

Also, you can set a reference to Microsoft.Visua lBasic.dll, and then
access the methods in C#, as they are just static methods exposed of classes
in the Microsoft.Visua lBasic namespace.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Tina" <ti**********@n ospammeexcite.c om> wrote in message
news:OS******** ******@TK2MSFTN GP02.phx.gbl...
I'm learning C# by converting a large asp.net project to C# that was
written in vb.net and option strict was turned off so it's a nice
challenge and it is really teaching me C#.

This project used a lot of methods in the VisualBasic Namespace. These
methods are really valuable and it seems they might be the reason some say
VB.Net is more productive that C# albeit less safe with option strict
turned off.

My question is: Is there any docs, anywhere, that map C# methods that are
the counterpart of methods in the visualbasic namespace? I have already
found that the String class has a lot of them but there are date functions
and other things where a good map would come in handy.

Thanks,
T

May 21 '06 #2
In addition, you will not find ANY differences in the class methods since
the .NET Framework classes are language-independant. Any String
properties/methods you could use in VB.NET, you use exactly the same way in
C# (or any other .NET language).

For just this reason, there are many VB.NET developers out there (myself
included), that do not use the Microsoft.Visua lBasic Namespace at all when
writing VB.NET code. Instead, we turn Option Strict on and use the .NET
Framework Classes and their properties & methods. For example, instead of
using CStr(), I'd use the Object Method .ToString(). There can be
differences in how the VisualBasic function operates compared to the .NET
Framework Class & more code may be required in some cases, but the code you
wind up with is more Object-Oriented (IMHO) and easier to convert should
that become an issue.

There are also those out there that disagree with me and say that you should
feel free to use the Microsoft.Visua lBasic Namespace, because that IS one of
the Namespaces in the .NET Framework.

I think it comes down to preferences. In my case, I'd rather shed my legacy
ties to VB 6.0 and not use Microsoft.Visua lBasic stuff at all.

HTH

-Scott
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in
message news:uQ******** ******@TK2MSFTN GP03.phx.gbl...
Tina,

There isn't always a one-to-one mapping of the functions that are
native VB as opposed to what is typically exposed in C#.

I don't know of such a document, but if you post the methods here that
you are having trouble with, I'm sure we can pose alternatives.

Also, you can set a reference to Microsoft.Visua lBasic.dll, and then
access the methods in C#, as they are just static methods exposed of
classes in the Microsoft.Visua lBasic namespace.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Tina" <ti**********@n ospammeexcite.c om> wrote in message
news:OS******** ******@TK2MSFTN GP02.phx.gbl...
I'm learning C# by converting a large asp.net project to C# that was
written in vb.net and option strict was turned off so it's a nice
challenge and it is really teaching me C#.

This project used a lot of methods in the VisualBasic Namespace. These
methods are really valuable and it seems they might be the reason some
say VB.Net is more productive that C# albeit less safe with option strict
turned off.

My question is: Is there any docs, anywhere, that map C# methods that are
the counterpart of methods in the visualbasic namespace? I have already
found that the String class has a lot of them but there are date
functions and other things where a good map would come in handy.

Thanks,
T


May 21 '06 #3
Download the demo edition of our Instant C# VB to C# converter. You can see
how many of the VisualBasic namespace methods are translated (we translate
the methods the have one-to-one equivalents in the framework, or nearly
one-to-one).
--
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C# to C++ converter & VB to C++ converter
Instant J#: VB to J# converter

"Tina" wrote:
I'm learning C# by converting a large asp.net project to C# that was written
in vb.net and option strict was turned off so it's a nice challenge and it
is really teaching me C#.

This project used a lot of methods in the VisualBasic Namespace. These
methods are really valuable and it seems they might be the reason some say
VB.Net is more productive that C# albeit less safe with option strict turned
off.

My question is: Is there any docs, anywhere, that map C# methods that are
the counterpart of methods in the visualbasic namespace? I have already
found that the String class has a lot of them but there are date functions
and other things where a good map would come in handy.

Thanks,
T

May 21 '06 #4
"Tina" <ti**********@n ospammeexcite.c om> wrote:
My question is: Is there any docs, anywhere, that map C# methods that are
the counterpart of methods in the visualbasic namespace? I have already
found that the String class has a lot of them but there are date functions
and other things where a good map would come in handy.


I would use .NET Reflector to see how the VisualBasic assembly methods
are implemented.

-- Barry

--
http://barrkel.blogspot.com/
May 21 '06 #5
Is there any way to disable use of the VisualBasic namespace when developing
in VB?
T
"Scott M." <s-***@nospam.nosp am> wrote in message
news:ek******** ********@TK2MSF TNGP02.phx.gbl. ..
In addition, you will not find ANY differences in the class methods since
the .NET Framework classes are language-independant. Any String
properties/methods you could use in VB.NET, you use exactly the same way
in C# (or any other .NET language).

For just this reason, there are many VB.NET developers out there (myself
included), that do not use the Microsoft.Visua lBasic Namespace at all when
writing VB.NET code. Instead, we turn Option Strict on and use the .NET
Framework Classes and their properties & methods. For example, instead of
using CStr(), I'd use the Object Method .ToString(). There can be
differences in how the VisualBasic function operates compared to the .NET
Framework Class & more code may be required in some cases, but the code
you wind up with is more Object-Oriented (IMHO) and easier to convert
should that become an issue.

There are also those out there that disagree with me and say that you
should feel free to use the Microsoft.Visua lBasic Namespace, because that
IS one of the Namespaces in the .NET Framework.

I think it comes down to preferences. In my case, I'd rather shed my
legacy ties to VB 6.0 and not use Microsoft.Visua lBasic stuff at all.

HTH

-Scott
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote
in message news:uQ******** ******@TK2MSFTN GP03.phx.gbl...
Tina,

There isn't always a one-to-one mapping of the functions that are
native VB as opposed to what is typically exposed in C#.

I don't know of such a document, but if you post the methods here that
you are having trouble with, I'm sure we can pose alternatives.

Also, you can set a reference to Microsoft.Visua lBasic.dll, and then
access the methods in C#, as they are just static methods exposed of
classes in the Microsoft.Visua lBasic namespace.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Tina" <ti**********@n ospammeexcite.c om> wrote in message
news:OS******** ******@TK2MSFTN GP02.phx.gbl...
I'm learning C# by converting a large asp.net project to C# that was
written in vb.net and option strict was turned off so it's a nice
challenge and it is really teaching me C#.

This project used a lot of methods in the VisualBasic Namespace. These
methods are really valuable and it seems they might be the reason some
say VB.Net is more productive that C# albeit less safe with option
strict turned off.

My question is: Is there any docs, anywhere, that map C# methods that
are the counterpart of methods in the visualbasic namespace? I have
already found that the String class has a lot of them but there are date
functions and other things where a good map would come in handy.

Thanks,
T



May 21 '06 #6
Scott,
You are to be commended! Right now I'm forced to write some VB.NET code in
an ASP.NET 1.1 App that was totally written in VB.NET and can't be converted.
And I keep typing semicolons at the end of each line of code! Yeesh!
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Scott M." wrote:
In addition, you will not find ANY differences in the class methods since
the .NET Framework classes are language-independant. Any String
properties/methods you could use in VB.NET, you use exactly the same way in
C# (or any other .NET language).

For just this reason, there are many VB.NET developers out there (myself
included), that do not use the Microsoft.Visua lBasic Namespace at all when
writing VB.NET code. Instead, we turn Option Strict on and use the .NET
Framework Classes and their properties & methods. For example, instead of
using CStr(), I'd use the Object Method .ToString(). There can be
differences in how the VisualBasic function operates compared to the .NET
Framework Class & more code may be required in some cases, but the code you
wind up with is more Object-Oriented (IMHO) and easier to convert should
that become an issue.

There are also those out there that disagree with me and say that you should
feel free to use the Microsoft.Visua lBasic Namespace, because that IS one of
the Namespaces in the .NET Framework.

I think it comes down to preferences. In my case, I'd rather shed my legacy
ties to VB 6.0 and not use Microsoft.Visua lBasic stuff at all.

HTH

-Scott
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in
message news:uQ******** ******@TK2MSFTN GP03.phx.gbl...
Tina,

There isn't always a one-to-one mapping of the functions that are
native VB as opposed to what is typically exposed in C#.

I don't know of such a document, but if you post the methods here that
you are having trouble with, I'm sure we can pose alternatives.

Also, you can set a reference to Microsoft.Visua lBasic.dll, and then
access the methods in C#, as they are just static methods exposed of
classes in the Microsoft.Visua lBasic namespace.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Tina" <ti**********@n ospammeexcite.c om> wrote in message
news:OS******** ******@TK2MSFTN GP02.phx.gbl...
I'm learning C# by converting a large asp.net project to C# that was
written in vb.net and option strict was turned off so it's a nice
challenge and it is really teaching me C#.

This project used a lot of methods in the VisualBasic Namespace. These
methods are really valuable and it seems they might be the reason some
say VB.Net is more productive that C# albeit less safe with option strict
turned off.

My question is: Is there any docs, anywhere, that map C# methods that are
the counterpart of methods in the visualbasic namespace? I have already
found that the String class has a lot of them but there are date
functions and other things where a good map would come in handy.

Thanks,
T



May 22 '06 #7
No, there is no way to "remove" the built-in reference to the
Microsoft.Visua lBasic Assembly in a VB.NET project. It's baked right in.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Tina" wrote:
Is there any way to disable use of the VisualBasic namespace when developing
in VB?
T
"Scott M." <s-***@nospam.nosp am> wrote in message
news:ek******** ********@TK2MSF TNGP02.phx.gbl. ..
In addition, you will not find ANY differences in the class methods since
the .NET Framework classes are language-independant. Any String
properties/methods you could use in VB.NET, you use exactly the same way
in C# (or any other .NET language).

For just this reason, there are many VB.NET developers out there (myself
included), that do not use the Microsoft.Visua lBasic Namespace at all when
writing VB.NET code. Instead, we turn Option Strict on and use the .NET
Framework Classes and their properties & methods. For example, instead of
using CStr(), I'd use the Object Method .ToString(). There can be
differences in how the VisualBasic function operates compared to the .NET
Framework Class & more code may be required in some cases, but the code
you wind up with is more Object-Oriented (IMHO) and easier to convert
should that become an issue.

There are also those out there that disagree with me and say that you
should feel free to use the Microsoft.Visua lBasic Namespace, because that
IS one of the Namespaces in the .NET Framework.

I think it comes down to preferences. In my case, I'd rather shed my
legacy ties to VB 6.0 and not use Microsoft.Visua lBasic stuff at all.

HTH

-Scott
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote
in message news:uQ******** ******@TK2MSFTN GP03.phx.gbl...
Tina,

There isn't always a one-to-one mapping of the functions that are
native VB as opposed to what is typically exposed in C#.

I don't know of such a document, but if you post the methods here that
you are having trouble with, I'm sure we can pose alternatives.

Also, you can set a reference to Microsoft.Visua lBasic.dll, and then
access the methods in C#, as they are just static methods exposed of
classes in the Microsoft.Visua lBasic namespace.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Tina" <ti**********@n ospammeexcite.c om> wrote in message
news:OS******** ******@TK2MSFTN GP02.phx.gbl...
I'm learning C# by converting a large asp.net project to C# that was
written in vb.net and option strict was turned off so it's a nice
challenge and it is really teaching me C#.

This project used a lot of methods in the VisualBasic Namespace. These
methods are really valuable and it seems they might be the reason some
say VB.Net is more productive that C# albeit less safe with option
strict turned off.

My question is: Is there any docs, anywhere, that map C# methods that
are the counterpart of methods in the visualbasic namespace? I have
already found that the String class has a lot of them but there are date
functions and other things where a good map would come in handy.

Thanks,
T



May 22 '06 #8
"Tina" <ti**********@n ospammeexcite.c om> wrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
Is there any way to disable use of the VisualBasic namespace when
developing in VB?


Unfortunately not.
May 22 '06 #9

Mark Rae wrote:
"Tina" <ti**********@n ospammeexcite.c om> wrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
Is there any way to disable use of the VisualBasic namespace when
developing in VB?


Unfortunately not.


You and Peter Bromberg both said this. However, I seem to be able in
VB2005 Express to uncheck Microsoft.Visua lBasic from the list of
project references, causing lines such as this

Dim d As DateTime = Today

to fail to compile. What gives?

Oh, and what's the C# for 'today' ?

--
Larry Lard
Replies to group please

May 22 '06 #10

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

Similar topics

22
5504
by: Keith MacDonald | last post by:
Hello, Is there a portable (at least for VC.Net and g++) method to convert text between wchar_t and char, using the standard library? I may have missed something obvious, but the section on codecvt, in Josuttis' "The Standard C++ Library", did not help, and I'm still awaiting delivery of Langer's "Standard C++ IOStreams and Locales". Thanks,
2
2874
by: mike | last post by:
regards: I follow the following steps to converting from HTML to XHTML http://webpageworkshop.co.uk/main/xhtml_converting My parser is http://htmlparser.sourceforge.net/ Xhtml version is 1.0 from http://nds.nokia.com/uaprof/N6600r100.xml but nokia mobile browser cannot identify the converted file(XHTML1.0). Is there something wrong with my procedure.
5
2527
by: Robert | last post by:
I have a series of web applications (configured as separate applications) on a server. There is a main application at the root and then several virtual directories that are independant applications. I am testing an upgrade of all of the sites and have converted the main root site...although not necessarily fixed any issues. I move on instead and converted one of the virtual roots that is a seperate
0
1092
by: Sugan | last post by:
Hi, I'm converting a VB 6.0 project to VB 2005. There are few issues, where i got stuck up. They are 1. 'Ambient' is not a member of 'System.Windows.Forms.UserControl' This is the code that gives this error. If (mbHasFocus Or MyBase.Ambient.DisplayAsDefault) And m_Style <> 0
2
1337
by: sparks | last post by:
When I converted a database yesterday I noticed one little thing I had not seen before. Any fields on the forms that were visible=no became visible = yes after the conversion.. Is there any other little things like this that come up that I have not thought of? thank you for any info about this
0
9579
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10326
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10075
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9143
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7615
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6851
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5520
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4295
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.