The part in bold is the part I need help with. I'm using VB 2003 and That line is VB6 code. The Right and Left functions don't apply to VB2003 and I need to know what I can replace that with to get the same result. Here I'm trying to update the displaying of the selected word as the user picks a letter. I have absolutely no clue what would replace it as I haven't used left and right before. Help? Thanks.


Sub Letterpick()
Dim i As Integer
nomatch = True
For i = 1 To length
letter2 = Mid(allwords(rndnum), i, 1)
If letter2 = letter Then
nomatch = False
lblWORD.Text = Left(lblWORD.Text, i - 1) _
& letter2 & Right(lblWORD.Text, length - i)

End If
Next
End If
End Sub

Recommended Answers

All 2 Replies

I am not exactly sure what you would like to do with the text of this label, but if you want to include a number of spaces (the number is always varying) to the left and right of the text, then you can use the padleft and padright methods. Just write lblWORD.text.padleft, or lblWORD.text.padright, to use it.

hope that helps,
adrcam

Try this:
lblWord.Text = lblWord.Text.Substring(0, i - 1) & letter2 & str.Substring(i)

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.