netnewb2002
Member
Im trying to create a guessing game. Is there any sample code / Links for subsituting asteriks in for the word in .NET?
It would be the same word but hidden by the asteriks, and how would I subsitute a letter in those asteriks?
I started out trying to read a random word from file to the text box:
[VB]
Dim sWords() As String hold words from file
Private Sub frmguess_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
read in the file
Dim fs As FileStream
Dim reader As StreamReader
fs = New FileStream("words.txt", FileMode.Open) word to bin directory
reader = New StreamReader(fs)
Read in the words
While reader.Peek <> -1
If sWords Is Nothing Then
ReDim Preserve sWords(0)
Else
ReDim Preserve sWords(sWords.GetUpperBound(0) + 1)
End If
sWords(sWords.GetUpperBound(0)) = reader.ReadLine read in the word
txtwords.text=swords /// ?
End While
[/VB]
Cant seem to get the word from the file to display in the textbox. Any Ideas?
Thanks.
It would be the same word but hidden by the asteriks, and how would I subsitute a letter in those asteriks?
I started out trying to read a random word from file to the text box:
[VB]
Dim sWords() As String hold words from file
Private Sub frmguess_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
read in the file
Dim fs As FileStream
Dim reader As StreamReader
fs = New FileStream("words.txt", FileMode.Open) word to bin directory
reader = New StreamReader(fs)
Read in the words
While reader.Peek <> -1
If sWords Is Nothing Then
ReDim Preserve sWords(0)
Else
ReDim Preserve sWords(sWords.GetUpperBound(0) + 1)
End If
sWords(sWords.GetUpperBound(0)) = reader.ReadLine read in the word
txtwords.text=swords /// ?
End While
[/VB]
Cant seem to get the word from the file to display in the textbox. Any Ideas?
Thanks.