I need to find a way to write a line in a console application, and still accept input on the same line. is there a way to do this?
Here's my code.
Imports System.IO
Imports System.Net.Sockets
Module Module1
Sub Main()
Try
Console.WriteLine("Type your nickname")
Dim serverListener As New TcpClient("localhost", 8585)
Dim readStream As Stream = serverListener.GetStream
serverListener.SendBufferSize = 256
Console.WriteLine("Input Lines:")
Dim str As String = Console.ReadLine(3) & Console.ReadLine()
While True
Dim sendBuff As Byte() = System.Text.Encoding.ASCII.GetBytes(str)
readStream.Write(sendBuff, 0, sendBuff.Length)
If str.StartsWith(".") Then
GoTo Done
End If
str = Console.ReadLine(3) & Console.ReadLine()
End While
Done: Console.WriteLine("Done")
Catch exp As Exception
Console.WriteLine("Exception: " + exp.ToString())
End Try
End Sub
End ModuleOffline
System.Console.Write("What's your name? ")
Dim Name As String
Name = Console.ReadLine
Use write. Writeline basicly pushes enter after text is written.
Last edited by what-the (2011-03-09 09:03:04)
My site Offline