1
(我是很新的編碼,所以儘量保持你的答案基本)第一個字母被切斷
我正在嘗試連接一個玩家檢查器xbox.com/blahblahblah/gamertag,如果返回gamertag的配置文件,它表示它已被使用。
當您鍵入第一個gamertag時,它可以工作。但是當你輸入第二個時,它不會。
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
Kenogu給出的答案是正確的,你也已經聲明瞭一個函數blahblah,它實際上是一個子程序,因爲你沒有返回任何東西,應該聲明爲Sub。 –