S
Steven Smith
-----Original Message-----
Hi guys
Heh where do I start this time
first of all thanks for your responses
I've managed to implement the sugestions from Fergus,
Herfried & jeremy, however doing this has highlighted
another problem in the following For...Next loop.
since the letter count for the game is now dynamic the
index range which is searched to determine if the chosen
letter appears in the secret word also has to be dynamic
i.e for intIndex = 0 to 4
was fine for a consistent 5 letter word but now obviously
this is no use now.
Sooooo what I thought I would do is pull the string
length from mstrWord.length and assign the value to an
integer as follow's:
intLength = mstrword.length
for intIndex = 0 to intlength
however when the game begins and a letter is chosen the
following line kicks back with the error 'Index and
length must refer to a location within the string':
strCharacter = mstrWord.Substring(intIndex, 1)
this out of range error doesn't make sense to me as the
loop should check the index range of 0 to the value of
intLength.
///
'search for the selected letter in the secret word
For intIndex = 0 To 4
'assign current character to the strCharacter
variable
strCharacter = mstrWord.Substring(intIndex, 1)
'determine whether or not the current
character matches the selected letter
If strCharacter = objLetterLabel.Text Then
'replace appropriate dash/es in the
strPartialWord variable
Mid(strPartialWord, intIndex + 1) =
objLetterLabel.Text
'indicate that a replacement was made
blnReplaced = True
End If
Next intIndex
///
now my head hurts, but I'm determined to make this
work...
Regards Steve