473,327 Members | 2,112 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,327 software developers and data experts.

Help in converting to C#

Can someone help me convert the code below to VB.NET.
Thanks

Function getXML(ByVal sourceFile As String)

Dim myRequest As System.Net.WebRequest =
System.Net.WebRequest.Create(sourceFile)

Dim myResponse As System.Net.WebResponse = myRequest.GetResponse()

Dim myReader As System.Xml.XmlTextReader = New
System.Xml.XmlTextReader(myResponse.GetResponseStr eam())

Dim doc As System.Xml.XmlDocument = New System.Xml.XmlDocument

doc.Load(myReader)

getXML = doc

myResponse.Close()

myReader.Close()

End Function
Nov 21 '05 #1
6 1255
Looks like it is already in VB.NET...:-)

--
Rgds,
Anand
VB.NET MVP
http://www.dotnetindia.com
"Patrick.O.Ige" wrote:
Can someone help me convert the code below to VB.NET.
Thanks

Function getXML(ByVal sourceFile As String)

Dim myRequest As System.Net.WebRequest =
System.Net.WebRequest.Create(sourceFile)

Dim myResponse As System.Net.WebResponse = myRequest.GetResponse()

Dim myReader As System.Xml.XmlTextReader = New
System.Xml.XmlTextReader(myResponse.GetResponseStr eam())

Dim doc As System.Xml.XmlDocument = New System.Xml.XmlDocument

doc.Load(myReader)

getXML = doc

myResponse.Close()

myReader.Close()

End Function

Nov 21 '05 #2
Cool ...

Well it would be really difficult for one to answer "How to convert Vb.Net
code into Vb.Net" ? :)

Anyway you can find an utility which do it all.

Check it out here.
http://wajahatabbas.blogspot.com/200...converter.html

--
Wajahat Abbas
http://www.wajahatabbas.com
"Anand[MVP]" wrote:
Looks like it is already in VB.NET...:-)

--
Rgds,
Anand
VB.NET MVP
http://www.dotnetindia.com
"Patrick.O.Ige" wrote:
Can someone help me convert the code below to VB.NET.
Thanks

Function getXML(ByVal sourceFile As String)

Dim myRequest As System.Net.WebRequest =
System.Net.WebRequest.Create(sourceFile)

Dim myResponse As System.Net.WebResponse = myRequest.GetResponse()

Dim myReader As System.Xml.XmlTextReader = New
System.Xml.XmlTextReader(myResponse.GetResponseStr eam())

Dim doc As System.Xml.XmlDocument = New System.Xml.XmlDocument

doc.Load(myReader)

getXML = doc

myResponse.Close()

myReader.Close()

End Function

Nov 21 '05 #3
Convert VB.Net to C#:
http://www.developerfusion.co.uk/uti...btocsharp.aspx

Convert C# to VB.Net:
http://www.developerfusion.co.uk/uti...sharptovb.aspx

--
Saber S.
http://maghalat.com

"Patrick.O.Ige" <na********@hotmail.com> wrote in message
news:uw****************@TK2MSFTNGP09.phx.gbl...
Can someone help me convert the code below to VB.NET.
Thanks

Function getXML(ByVal sourceFile As String)

Dim myRequest As System.Net.WebRequest =
System.Net.WebRequest.Create(sourceFile)

Dim myResponse As System.Net.WebResponse = myRequest.GetResponse()

Dim myReader As System.Xml.XmlTextReader = New
System.Xml.XmlTextReader(myResponse.GetResponseStr eam())

Dim doc As System.Xml.XmlDocument = New System.Xml.XmlDocument

doc.Load(myReader)

getXML = doc

myResponse.Close()

myReader.Close()

End Function

Nov 21 '05 #4
The problem with the developerfusion conversion is that it isn't C# code.
The most obvious problem is that there is no implicit assignment to the
method name in C# like there is in VB.

Our Instant C# VB.NET to C# converter produces:

public object getXML(string sourceFile)
{
object tempgetXML = null;
System.Net.WebRequest myRequest =
System.Net.WebRequest.Create(sourceFile);
System.Net.WebResponse myResponse = myRequest.GetResponse();
System.Xml.XmlTextReader myReader = new
System.Xml.XmlTextReader(myResponse.GetResponseStr eam());
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
doc.Load(myReader);
tempgetXML = doc;
myResponse.Close();
myReader.Close();
return tempgetXML;
}

--
David Anton
www.tangiblesoftwaresolutions.com
Home of:
Instant C#: VB.NET to C# Converter
Instant VB: C# to VB.NET Converter
Instant J#: VB.NET to J# Converter

"Wajahat Abbas" wrote:
Cool ...

Well it would be really difficult for one to answer "How to convert Vb.Net
code into Vb.Net" ? :)

Anyway you can find an utility which do it all.

Check it out here.
http://wajahatabbas.blogspot.com/200...converter.html

--
Wajahat Abbas
http://www.wajahatabbas.com
"Anand[MVP]" wrote:
Looks like it is already in VB.NET...:-)

--
Rgds,
Anand
VB.NET MVP
http://www.dotnetindia.com
"Patrick.O.Ige" wrote:
Can someone help me convert the code below to VB.NET.
Thanks

Function getXML(ByVal sourceFile As String)

Dim myRequest As System.Net.WebRequest =
System.Net.WebRequest.Create(sourceFile)

Dim myResponse As System.Net.WebResponse = myRequest.GetResponse()

Dim myReader As System.Xml.XmlTextReader = New
System.Xml.XmlTextReader(myResponse.GetResponseStr eam())

Dim doc As System.Xml.XmlDocument = New System.Xml.XmlDocument

doc.Load(myReader)

getXML = doc

myResponse.Close()

myReader.Close()

End Function

Nov 21 '05 #5
See the actual conversion in my other post - note that the developerfusion
conversion for this sample does not produce viable C# code.
--
David Anton
www.tangiblesoftwaresolutions.com
Home of:
Instant C#: VB.NET to C# Converter
Instant VB: C# to VB.NET Converter
Instant J#: VB.NET to J# Converter
"Saber" wrote:
Convert VB.Net to C#:
http://www.developerfusion.co.uk/uti...btocsharp.aspx

Convert C# to VB.Net:
http://www.developerfusion.co.uk/uti...sharptovb.aspx

--
Saber S.
http://maghalat.com

"Patrick.O.Ige" <na********@hotmail.com> wrote in message
news:uw****************@TK2MSFTNGP09.phx.gbl...
Can someone help me convert the code below to VB.NET.
Thanks

Function getXML(ByVal sourceFile As String)

Dim myRequest As System.Net.WebRequest =
System.Net.WebRequest.Create(sourceFile)

Dim myResponse As System.Net.WebResponse = myRequest.GetResponse()

Dim myReader As System.Xml.XmlTextReader = New
System.Xml.XmlTextReader(myResponse.GetResponseStr eam())

Dim doc As System.Xml.XmlDocument = New System.Xml.XmlDocument

doc.Load(myReader)

getXML = doc

myResponse.Close()

myReader.Close()

End Function


Nov 21 '05 #6
"Patrick.O.Ige" <na********@hotmail.com> schrieb:
Can someone help me convert the code below to VB.NET.


Converting code between .NET programming languages
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=languageconverters&lang=en>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 21 '05 #7

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

Similar topics

5
by: Rex_chaos | last post by:
Hi all, I have a question about datatype converting. Consider the following types std::complex<double> and struct MyComplex { double re, im; }
4
by: jipster | last post by:
hi, i need help converting this java program to C++...are there any programs or nething that could be used to do this faster?? class hw2 { static public void main (String args) { hw2.test();}...
3
by: Colin J. Williams | last post by:
Python advertises some basic service: C:\Python24>python Python 2.4.1 (#65, Mar 30 2005, 09:13:57) on win32 Type "help", "copyright", "credits" or "license" for more information. >>> With...
3
by: alyssa | last post by:
Hi guys, May i know how to declare a string of binary data and pass it to the method? For example, int a={10010001120420052314} is it correct? and if i have receive the binary data, may i know...
4
by: Clark Stevens | last post by:
I have a program that I'm converting from VB6 to VB.NET. It reads in a text file containing barcode numbers and their corresponding descriptions. Then the user enters the barcode number and the...
32
by: robert d via AccessMonster.com | last post by:
I'm looking at converting DAO to ADO in my app. All of my DAO connections are of the following structure: Dim wsName As DAO.Workspace Dim dbName As DAO.Database Dim rsName As DAO.Recordset ...
13
by: Paraic Gallagher | last post by:
Hi, This is my first post to the list, I hope somebody can help me with this problem. Apologies if it has been posted before but I have been internet searching to no avail. What I am trying...
16
by: manmit.walia | last post by:
Hello All, I have tried multiple online tools to convert an VB6 (bas) file to VB.NET file and no luck. I was hoping that someone could help me covert this. I am new to the .NET world and still...
2
anukagni
by: anukagni | last post by:
Hi, iam having an database for that i have created an user manual includes help topics ..I prepared in the word format and i want to covert this to html help . Iam having Ms Html workshop but i...
10
by: minterman | last post by:
1. the program needs to convert btu to jules 2. Convert calories to joules 3. Convert joules to joules 4 exit the program. if the user type anything other than 1-4 the program should print a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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...

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.