This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-03-09 08:22:13

16Skittles
Scratcher
Registered: 2009-08-26
Posts: 1000+

[VB]Help me with a console application!

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.

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 Module

http://16skittles.tk/sig.png
Are you a student? Check out OnSchedule!

Offline

 

#2 2011-03-09 08:39:11

16Skittles
Scratcher
Registered: 2009-08-26
Posts: 1000+

Re: [VB]Help me with a console application!

Bump


http://16skittles.tk/sig.png
Are you a student? Check out OnSchedule!

Offline

 

#3 2011-03-09 09:02:43

what-the
Scratcher
Registered: 2009-10-04
Posts: 1000+

Re: [VB]Help me with a console application!

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)


http://imageshack.us/m/64/9034/ddfss.pngMy site
Find someone post count. Click posts under username. Find number of pages. Times that by 40 for min and 60 for max and you have a rough estimate of post count.

Offline

 

#4 2011-03-09 11:16:11

ob6160
Scratcher
Registered: 2010-10-10
Posts: 500+

Re: [VB]Help me with a console application!

what-the wrote:

System.Console.Write("What's your name? ")
        Dim Name As String
        Name = Console.ReadLine

Use write. Writeline basicly pushes enter after text is written.

U beat me 2 it  smile


http://i45.tinypic.com/2jcygsy.gif

Offline

 

Board footer