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

#1 2011-02-25 10:23:46

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

Help me debug my VB2010 code!

I don't understand the error.
This is the code for a LAN chat client. I found the base on the web, and am adding things such as usernames.

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(2) + 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()

            End While



Done:       Console.WriteLine("Done")



        Catch exp As Exception



            Console.WriteLine("Exception: " + exp.ToString())



        End Try





    End Sub



End Module

I get an error that says:
Error    1    'Sub Main' was not found in 'ConsoleApplication1.Module1'.    simplechatclient
This project does not have a valid Sub Main(). You must add
     Sub Main()
     End Sub
to a module.


Yet in the code, I have sub main and end sub. Any help?


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

Offline

 

#2 2011-02-25 10:43:07

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

Re: Help me debug my VB2010 code!

Works fine for me. Just copy the code to a new project.


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

 

#3 2011-02-25 13:25:44

TheSuccessor
Scratcher
Registered: 2010-04-23
Posts: 1000+

Re: Help me debug my VB2010 code!

Try re-running it. Just press F5.

Sometimes this happens to me. There's a problem with the error finder.


/* No comment */

Offline

 

Board footer