473,385 Members | 1,342 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to change Vb.net GetType(String) to C# code

this is vb.net CODE :

string msParcoWebSvc = mappConfig.GetValue("ParcoWebServiceURL",
GetType(String)).ToString

How to change code in C# :

I was done like this but iam getting error:

string msParcoWebSvc = mappConfig.GetValue("ParcoWebServiceURL",
GetType()).ToString();

An unhandled exception of type 'System.InvalidOperationException' occurred
in system.dll

Additional information: Type 'Parco.Form1' does not have a Parse method.

Regards

Karunkara Rao



Nov 16 '05 #1
1 6980
The C# equivalent to VB's global GetType function is "typeof".

Your C# code should be:
string msParcoWebSvc = mappConfig.GetValue("ParcoWebServiceURL",
typeof(string)).ToString();

Please download the Demo Edition of our Instant C# VB.NET to C# converter at
www.instantcsharp.com to easily obtain these comparisons.

David Anton
Tangible Software Solutions Inc.
www.tangiblesoftwaresolutions.com
Home of the Instant C# VB.NET to C# converter and the Instant VB C# to
VB.NET converter
"karunakar" wrote:
this is vb.net CODE :

string msParcoWebSvc = mappConfig.GetValue("ParcoWebServiceURL",
GetType(String)).ToString

How to change code in C# :

I was done like this but iam getting error:

string msParcoWebSvc = mappConfig.GetValue("ParcoWebServiceURL",
GetType()).ToString();

An unhandled exception of type 'System.InvalidOperationException' occurred
in system.dll

Additional information: Type 'Parco.Form1' does not have a Parse method.

Regards

Karunkara Rao



Nov 16 '05 #2

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

Similar topics

1
by: Peter | last post by:
Hi, the following is my question defined as below: - C# language - a custom dll,the class name = theNS.theClass - in a testing project, after add the reference - code: Type theType =...
2
by: VR | last post by:
Hello, Type oType1 = Type.GetType("System.Int32"); Type oType2 = Type.GetType("System.Windows.Forms.Label"); After executing the code above, oType1 is set to System.Int32 (valid type), while...
3
by: the fuzz | last post by:
yeah g'day..... is it somehow possible to not include the version & public key token in the call to Type.GetType(string) ie something like Type.GetType("System.Windows.Forms.ListView,...
9
by: Gugale at Lincoln | last post by:
In my code Type.GetType(text) works when text="System.IO.File". However, it doesn't work when text="System.Windows.Forms.Button". In general it works for classes in System.dll assembly. Is there...
7
by: Sky | last post by:
I have been looking for a more powerful version of GetType(string) that will find the Type no matter what, and will work even if only supplied "{TypeName}", not the full "{TypeName},{AssemblyName}"...
2
by: Vayse | last post by:
I have read that it is possible to change code while debugging in VB2005, just like you could do in VB6. If so, how do you do it? Thanks Vayse
2
by: JM | last post by:
Hi, I used to chage my code during debugging with Visual Studio 2003 (I just stopped the code using a break point and VS2003 allowed me to change the code, and continue debugging), but now with...
8
by: Martin Eckart | last post by:
Hi folks, Who can explain me why the following expression does not result in getting the correct type, but null: Type t = Type.GetType("System.Xml.XmlReader"); For "System.String" it works...
2
by: jon | last post by:
I'm trying to write a block of code that can create an instance of a generic object, with the Type coming in as a dynamic string. It isn't working yet. Any advice how I can dynamically create the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.