I’m just going to throw all my code in here in case there’s something wrong with a piece of the code not in the “SelectName()” sub.
Module Module1
Dim selectednames As String = ""
Dim index As Short = 0
Dim inarray As Boolean = False
Dim amountofkeys As Short
Dim namesarray() As String
Dim names As String = ""
Dim input As String = ""
Dim totalnames As Short = 0
Dim indexofcomma As Short = 0
Sub Main()
Console.Write("Howmany keys are there to be given away? ")
amountOfKeys = CShort(Console.ReadLine())
Start()
While Not amountofkeys = -1
SelectName(names, totalnames)
amountofkeys = amountofkeys - 1
End While
Console.Write("The winners are: " & selectednames)
Console.ReadLine()
End Sub
Sub SelectName(ByVal names As String, ByVal totalnames As Short)
ReDim namesarray(totalnames - 1)
If inarray = False Then
For x = 0 To totalnames - 1
indexofcomma = InStr(names, ",")
namesarray(x) = Left(names, indexofcomma - 1)
names = Mid(names, indexofcomma + 1, (Len(names)))
Next
inarray = True
End If
Randomize()
index = Int(Rnd() * (totalnames - 1))
For x = 0 To totalnames - 1
Debug.Print("namesarray(" & x & ") = " & namesarray(x))
Next
selectednames &= namesarray(index) & " "
movenames()
End Sub
Sub movenames()
For x = index To totalnames - 1
namesarray(index) = namesarray(index + 1)
Next
totalnames -= 1
End Sub
Sub Start()
Console.WriteLine("Enter all the viewer's names, one by one.")
Console.WriteLine("Once all names have been entered, press 0.")
input = Console.ReadLine()
While Not input = "0"
names &= input & ","
totalnames += 1
input = Console.ReadLine()
End While
End Sub
End Module
Here’s an image of what it does (I suppose you can see what went wrong)
13 inputs, 3 outputs expected, only 1 output given.

Any chance any of you can help me out in finding what’s going wrong?
As from what I’ve figured out so far, it’s doing the correct amount of loops etc. It’s just as soon as it starts generating the “winner” for the 2nd game key it doesn’t get a string value from namesarray.
Also, why is
For x = 0 To totalnames - 1
Debug.Print("namesarray(" & x & ") = " & namesarray(x))
Next
not giving me a debug output?
Simplify your problem.
Make names a List(Of String), and instead of adding “,name” to the string, use
names.Add(namereadfromconsole). Instead of looping though the names string, a simple names.Contains(thename) could replaceinArrayflag you’re using. And instead ofmovenames()call, a simplenames.Remove(nametoremove).As far as the Debug.Print() call not displaying anything, try checking, under Options->Debugging->General->[x] Redirect all Output Window text to the Immediate Window.