Computer Learning Zone CLZ Access Excel Word Windows

But I try not to think with my gut. If I'm serious about understanding the world, thinking with anything besides my brain, as tempting as that might be, is likely to get me into trouble.

-Carl Sagan
 
Home   Courses   Index   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > Forums > VB
Back to Visual Basic Forum    Comments List
Hangman Game Upload Images   Link   Email  
Kevin Robertson 
I have recreated your Hangman game in VB and added scoring to it.
The words are stored in a Text File and loaded into a List when the game starts.
Kevin Robertson 

Kevin Robertson 

Alex Hedley 
Nice!
Richard Rost 
Sweeeeet!
Kevin Robertson 
***UPDATE***

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
Alex Hedley 
Does it error if the text file is missing?
Kevin Robertson 
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)


LOL. Learning is so much fun.
Alex Hedley 
I've missed that many times myself, always great when you have the sample data you expect but a pain when you don't.

Also could people put the words in in different ways
Is it
Word1
Word2
Word3

But what if people put
Word1 Word2
Word3
Word4
Kevin Robertson 
Yeah, it only works if there is only one word per line. Ideally, a database would probably be a better option.
Alex Hedley 
Presume you've already seen these:

- VisualBasic.NET Tips
- Connect to Access DB
Kevin Robertson 
Yeah. Did you know there is a mistake in the code?

Dim con As New OleDb.OleDbConnection

Later in the code ConAN is referred to instead.
Alex Hedley 
Oops, best get that updated.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Visual Basic Forum.
 

 
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2024 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 3/28/2024 9:19:21 AM. PLT: 0s