Page 1 of 1
Help C# to .NET !
Posted: Sat Jan 15, 2011 4:05 pm
by M1z23R
Don't know where should i put this but any way, i am trying to convert chat application C# code into VB.NET !
I can't get this ... :(
Code: Select all Dim srReceiver As StreamReader
srReceiver = new StreamReader(tcpServer.GetStream());
If anyone knows where to put this or if knows how to convert ?
Online code didn't make it usable :/
Re: Help C# to .NET !
Posted: Sat Jan 15, 2011 4:24 pm
by Axel
srReceiver = new StreamReader(tcpServer.GetStream()); To vb =
Dim srReceiver as SteamReader = new StreamReader(args) , with other words , args should be "tcpServer.GetStream()"
Re: Help C# to .NET !
Posted: Sat Jan 15, 2011 4:54 pm
by M1z23R
Re: Help C# to .NET !
Posted: Sat Jan 15, 2011 5:29 pm
by Agust1337
on the picture is that c# or vb?
Re: Help C# to .NET !
Posted: Sat Jan 15, 2011 5:35 pm
by Codex
Code: Select allsrReceiver = new StreamReader(tcpServer.GetStream());
=
Code: Select allDim srReceiver as StreamReader = tcpServer.Getstream()
Tell me if it works...
Re: Help C# to .NET !
Posted: Sat Jan 15, 2011 5:41 pm
by MrAksel
Codex, if that should work, you have to remove the 'New' specifier
And what is the type of 'tcpServer' is it a tcpClient or tcpListener? If it is a client you can use this:
Code: Select allDim s As Net.Sockets.NetworkStream = tcpServer.GetStream
Dim baseByte() As Byte
s.Read(baseByte, 0, s.Length)
Dim m As IO.Stream = New IO.MemoryStream(baseByte)
Dim srReceiver As New IO.StreamReader(m)
Re: Help C# to .NET !
Posted: Sat Jan 15, 2011 5:48 pm
by M1z23R
Dim tcpServer = New TcpClient()
Re: Help C# to .NET !
Posted: Sat Jan 15, 2011 5:53 pm
by Codex
M1z23R wrote:Dim tcpServer = New TcpClient()
If that solved it then lock your topic, if possible.
Re: Help C# to .NET !
Posted: Sat Jan 15, 2011 6:06 pm
by M1z23R
MrAksel wrote:Codex, if that should work, you have to remove the 'New' specifier
And what is the type of 'tcpServer' is it a tcpClient or tcpListener? If it is a client you can use this:
Code: Select allDim s As Net.Sockets.NetworkStream = tcpServer.GetStream
Dim baseByte() As Byte
s.Read(baseByte, 0, s.Length)
Dim m As IO.Stream = New IO.MemoryStream(baseByte)
Dim srReceiver As New IO.StreamReader(m)
"This stream does not support seek operations."
:( Still nothing :/
Still didn't solve it :(
Re: Help C# to .NET !
Posted: Sat Jan 15, 2011 6:16 pm
by M1z23R
THANKS A LOT ! I got it
I used half of your code Codex
Code: Select allDim s As Net.Sockets.NetworkStream = tcpServer.GetStream
srReceiver = New StreamReader(s)
It worked perfectly !
Tnx