locked
The Code runs Twice RRS feed

  • Question

  • Code runs twice:

    I have a little knowledge in VB. Decided to gain more skills.
    When I run the code shown below using both

    1. Debug > Start Without Debugging

    2. by hitting Start button

    the code runs two times. Not sure what is happening. I request help.


    Module Module1
    
    	Sub Main()
    		Dim Counter = 0
    		Dim outPutString
    		Dim currentChar = "-"c
    
    		Do
    			Counter = Counter + 1
    			If Counter < 11 Then
    				outPutString = New String(currentChar, Counter)
    				Console.WriteLine(outPutString)
    				Threading.Thread.Sleep(500)
    				'Loop While True
    			End If
    		Loop While Counter < 15
    		'Console.Read()
    		'Console.ReadLine()
    	End Sub
    
    End Module

    Friday, August 7, 2020 3:33 AM

All replies

  • The problem does not seem caused by this code.

    Try an investigation: restart Visual Studio and create another simple project:

    Module Module1

       Sub Main()

          Console.WriteLine("TEST")

          Console.ReadLine()

       End Sub

    End Module


    Do you see the same problem?


    • Edited by Viorel_MVP Friday, August 7, 2020 5:48 AM
    Friday, August 7, 2020 5:47 AM