I have this code, created in VB.NET 2005
---
Private Sub frmTestAllRows_Load...
RandomizeLBL(Me, "lblLetter*")
End Sub
---
Private Sub RandomizeLBL...
Dim rnd As New Random
For Each ctrl As Control In container.Controls
Dim lblLetter As Label = TryCast(ctrl, Label)
If lblLetter IsNot Nothing AndAlso lblLetter.Name Like pattern Then
lblLetter.Text = Chr(rnd.Next(97, 122).ToString)
End If
Next
End Sub
---
This works for selecting any chara on the keyboard and putting it into a label when the form is loaded. BUT, is there any way to modify this so that it can only select random letters from, for example, the top row of the keyboard. I was hoping i could modify the ascii code to look for, e.g. 97, 103, 107.
Any ideas?
2007-02-20
10:14:31
·
2 answers
·
asked by
Anonymous
in
Computers & Internet
➔ Programming & Design