If the Word Bank is empty an Exception was thrown. Yes I forgot to test it. lol
If WordBank.Count > 0 Then
TxtWordHidden.Text = WordBank(WordNum).ToUpper
Else
If MessageBox.Show("There are no words in the Word Bank!" & vbNewLine &
"Do you want to add new words now?", "No Words Available",
MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation) = DialogResult.Yes Then
Shell("Notepad.exe " & AppDomain.CurrentDomain.BaseDirectory & "WordBank.txt", AppWinStyle.NormalFocus)
BtnNewGame.Visible = True
Else
Close()
End If
End If
That's a great point Alex. Yes - "FileNotFoundException" which I have now fixed.
Dim Filename As String = AppDomain.CurrentDomain.BaseDirectory & "WordBank.txt"
If Not IO.File.Exists(Filename) Then
IO.File.Create(Filename).Close()
End If
Dim objFile As New IO.StreamReader(Filename)
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.
This thread is now CLOSED. If you wish to comment, start a NEW discussion in
Visual Basic Forum.