2012-09-30 4 views
1

(Я очень новой для кодирования, поэтому постарайтесь, чтобы ваши ответы основные.)Первая буква получает отрезана

Я делаю Gamertag проверки, который пытается подключиться к xbox.com/blahblahblah/gamertag и если он возвращает профиль gamertag, он говорит, что он взят.

Когда вы вводите первый игровой сервер, он работает. Но когда вы вводите второй, это не так.

Пример: http://imgur.com/cbT7o

Module Module1 

Sub Main() 
    Console.ForegroundColor = ConsoleColor.Yellow 
    Console.WriteLine("DiamondHacks's Gamertag Checker!") 
    Console.ForegroundColor = ConsoleColor.Magenta 
    Console.WriteLine("Spaced Gamertags do NOT work :(") 
    Console.ForegroundColor = ConsoleColor.Blue 
    Console.WriteLine("Just type a word, and it will check if it is available! :)") 
    Console.ForegroundColor = ConsoleColor.Green 
    Console.WriteLine("Good Luck getting some OG Gamertags :)") 
    Console.ForegroundColor = ConsoleColor.Cyan 
    blahblah() 
End Sub 

Function blahblah() 

    Dim userInput As String = Console.ReadLine 
    If Not String.IsNullOrEmpty(userInput) Then 
     If checkGamerTag(userInput) = True Then 
      Console.ForegroundColor = ConsoleColor.Red 
      Console.WriteLine("Sorry, But the Gamertag ""{0}"" is taken!", userInput) 
      Console.ForegroundColor = ConsoleColor.Cyan 
     Else 
      Console.ForegroundColor = ConsoleColor.Green 
      Console.WriteLine("The gamertag ""{0}"" is not taken! :D Better get it before I do!", userInput) 
      Console.ForegroundColor = ConsoleColor.Cyan 
     End If 
    End If 
    Console.Read() 
    blahblah() 
    Console.ForegroundColor = ConsoleColor.Cyan 
End Function 

Private Function checkGamerTag(ByVal gamerTag As String) As Boolean 
    If Not String.IsNullOrEmpty(gamerTag) Then 
     Try 
      Dim callBack As String = New System.Net.WebClient().DownloadString(String.Format("http://live.xbox.com/en-GB/Profile?gamertag={0}", gamerTag)) 
      If Not String.IsNullOrEmpty(callBack) Then 
       If Not callBack.Contains("Ooops! What happened to this page?") Or callBack.Contains(gamerTag) Then Return True 
      Else 
       Return False 
      End If 
     Catch : Return False : End Try 
    End If 
End Function 

End Module 
+1

Ответ, который дал Kenogu, является правильным, вы также объявили функцию blahblah, которая на самом деле является подпрограммой, поскольку вы ничего не возвращаете от нее и должны быть объявлены как Sub. –

ответ

4

Ваш призыв к Console.Read(), прежде чем ваш призыв к blahblah() жует до первого символа следующей строки.

Смежные вопросы