Computer Learning Zone CLZ Access Excel Word Windows

No trees were killed to send this message, but a large number of electrons were terribly inconvenienced.

-Neil deGrasse Tyson
 
Home   Courses   Seminars   Templates   TechHelp   Fast Tips   Forums   Help   Contact   Join   Order   Logon  
 
Home > Forums > VB
 
Visual Basic Forum


Back to Visual Basic Forum
 

Hangman Game Upload Images   Link  
Kevin Robertson 
5 months ago
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
5 months ago

Kevin Robertson
5 months ago

Alex Hedley
5 months ago
Nice!
Richard Rost
5 months ago
Sweeeeet!
Kevin Robertson
5 months ago
***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
5 months ago
Does it error if the text file is missing?
Kevin Robertson
5 months ago
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
5 months ago
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
5 months ago
Yeah, it only works if there is only one word per line. Ideally, a database would probably be a better option.
Alex Hedley
5 months ago
Presume you've already seen these:

- VisualBasic.NET Tips
- Connect to Access DB
Kevin Robertson
5 months ago
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
5 months ago
Oops, best get that updated.

This thread is now closed. If you wish to comment, start a NEW discussion, below.
 


Back to Visual Basic Forum Comments
 

Start a NEW Conversation
 
Only students may post right now. Click here for more information on how you can set up an account. If you are a student, please LOG ON first.
 
Subscribe
 
 

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
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
Email Richard
Mailing Address
Phone Number
Fax Number
Course Survey
Blog RSS Feed    Twitter

YouTube Channel    LinkedIn