|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Help converting C# code to VBImports System.Data Imports System.Data.SqlClient Imports System.Net Imports System.IO.Stream 'Get the stream containing content returned by the server. Dim dataStream = response.GetResponseStream() 'Open the stream using a StreamReader for easy access. Dim reader = New StreamReader(dataStream) ---error StreamReader not defined 'Read the content. string[] responseFromServer = reader.ReadToEnd ().Split(',') --not sure how to conver string[] If (responseFromServer.Length <> 6) Then Return End If me.txtLon.Text = responseFromServer[1] me.txtLat.Text = responseFromServer[0] Thanks. Phil,
This is very basic Visual Basic Net code about the differences, however I do it inline. > Imports System.Data Dir reader As New StreamReader(DataStream)> Imports System.Data.SqlClient > Imports System.Net > Imports System.IO.Stream > > 'Get the stream containing content returned by the server. > Dim dataStream = response.GetResponseStream() > > 'Open the stream using a StreamReader for easy access. > Dim reader = New StreamReader(dataStream) ---error > dim responseFromServer as string() => 'Read the content. > string[] responseFromServer = reader.ReadToEnd ().Split(',') > in a Sub> If (responseFromServer.Length <> 6) Then > Return End Sub > End If me.textLat.Text = responseFromServer(0) 'the first element from the spitted > > me.txtLon.Text = responseFromServer[1] > me.txtLat.Text = responseFromServer[0] string Code C# and VB http://www.harding.edu/USER/fmccown/WWW/vbnet_csharp_comparison.html Language compare http://msdn.microsoft.com/library/en-us/vsintro7/html/vxgrfLanguageEquivalents.asp Something about C# written by a C# adept http://www.pobox.com/~skeet/csharp/faq/#vb.or.csharp I hope this helps a little bit? Cor I hope this helps, Cor "Phill" <Ph***@discussions.microsoft.com> schrieb: .... should read 'Imports System.IO'.>I am trying to convert the following to VB: > Imports System.IO.Stream > 'Open the stream using a StreamReader for easy access. .... should read 'Dim Reader As New StreamReader(DataStream)'.> Dim reader = New StreamReader(dataStream) ---error > StreamReader not defined > 'Read the content. \\\> string[] responseFromServer = reader.ReadToEnd ().Split(',') > --not sure how to conver string[] Dim Response() As String = Reader.ReadToEnd().Split(","c) /// > me.txtLon.Text = responseFromServer[1] .... should read '... = ResponseFromServer(1)' and '... = > me.txtLat.Text = responseFromServer[0] ResponseFromServer(0)' respectively. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> Which converter did you use?
-- Show quoteHide quoteDavid Anton www.tangiblesoftwaresolutions.com Instant C#: VB to C# converter Instant VB: C# to VB converter Instant C++: C# to C++ converter Instant C++: VB to C++ converter "Phill" wrote: > I am trying to convert the following to VB: > > Imports System.Data > Imports System.Data.SqlClient > Imports System.Net > Imports System.IO.Stream > > 'Get the stream containing content returned by the server. > Dim dataStream = response.GetResponseStream() > > 'Open the stream using a StreamReader for easy access. > Dim reader = New StreamReader(dataStream) ---error > StreamReader not defined > > 'Read the content. > string[] responseFromServer = reader.ReadToEnd ().Split(',') > --not sure how to conver string[] > > If (responseFromServer.Length <> 6) Then > Return > End If > > me.txtLon.Text = responseFromServer[1] > me.txtLat.Text = responseFromServer[0] > > Thanks. David,
I was glad that Herfried did not give references to converters. I surely would have written to him that this code should be done without a converter even as it was alone to learn from it. As me he understood that probably. Just my thought, Cor Show quoteHide quote "David Anton" <DavidAn***@discussions.microsoft.com> schreef in bericht news:E670CB1B-DFB5-4024-8900-12F4E661EBAA@microsoft.com... > Which converter did you use? > -- > David Anton > www.tangiblesoftwaresolutions.com > Instant C#: VB to C# converter > Instant VB: C# to VB converter > Instant C++: C# to C++ converter > Instant C++: VB to C++ converter > > > "Phill" wrote: > >> I am trying to convert the following to VB: >> >> Imports System.Data >> Imports System.Data.SqlClient >> Imports System.Net >> Imports System.IO.Stream >> >> 'Get the stream containing content returned by the server. >> Dim dataStream = response.GetResponseStream() >> >> 'Open the stream using a StreamReader for easy access. >> Dim reader = New StreamReader(dataStream) ---error >> StreamReader not defined >> >> 'Read the content. >> string[] responseFromServer = reader.ReadToEnd ().Split(',') >> --not sure how to conver string[] >> >> If (responseFromServer.Length <> 6) Then >> Return >> End If >> >> me.txtLon.Text = responseFromServer[1] >> me.txtLat.Text = responseFromServer[0] >> >> Thanks.
Vb 2005 equivalent to VB6 CreateObject
Object reference not set to an instance of an object error User Control c# to vb.net conversion Using VS 2005 What do I load ? storing unicode in byte array? String parameter dll function my challenges with merging 2 Regex.Matches Schema Information not found in web.config |
|||||||||||||||||||||||