我正在創建一個視頻遊戲,我需要一次顯示文本一個字符,而互聯網的其他部分幾乎沒有什麼幫助,因爲它們是針對我一無所知的較舊版本的Visual Basic。如何在Visual Basic 2010中編碼打字機效果?
這裏是我的錯誤代碼:
Dim outfile As IO.StreamWriter
Dim infile As IO.StreamReader
Private Sub StartScreen_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim strTitle As String = " "
Dim strText() As String = {}
Dim intLoop As Integer = 0
If IO.File.Exists("save.txt") = False Then
outfile = IO.File.CreateText("save.txt")
End If
infile = IO.File.OpenText("save.txt")
Do Until infile.Peek = -1
strText(intLoop) = infile.Read
System.Threading.Thread.Sleep(1000)
intLoop += 1
Loop
intLoop = 0
Do While strText.Length <> intLoop
strTitle = strText(intLoop)
lblTitle.Text = lblTitle.Text & strTitle
intLoop += 1
Loop
infile.Close()
outfile.Close()
End Sub
爲什麼你的代碼有問題?它做什麼(或不做)你不明白? –
它根本不顯示錶格 – Kentaro51