SethR 0 Light Poster

Public Class Form1
Inherits System.Windows.Forms.Form
Dim hng As New Hang

Dim strWord As String

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
strWord = InputBox("Please enter a word for the user to guess.")
lblWord.Text = underscore(strWord.Length, "")


End Sub
Private Function underscore(ByVal wordlength As Integer, ByVal undscore As String) As String

For wordlength = 0 To wordlength - 1
underscore += "_ "
Next

Return underscore


End Function

Private Sub btnA_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnA.Click

Dim i As Integer


' For i = 0 To strWord.Length - 1
' If strWord.Substring(i, 1) = CStr(btnA.Text) Then

' strWord.Replace(strWord.Substring(i), "a")


' lblWord.Text = strWord

' End If


' Next

For i = 0 To strWord.Length - 1
If btnA.Text = strWord.Substring(0, 1) Then
strWord.Remove(i, 1)
strWord.Replace(CStr(strWord.Substring(0)), btnA.Text)

lblWord.Text = strWord

End If


Next


End Sub


End Class

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.