-
I got 2 questions:
1. how do I allow only small letters into a text box
2. I have text1.text, now the user puts in "hello" I also have 7 labels, go I want label1 to say h label2 to say e label 3 to say l, etc. how do I do it?
thanks in advance
dimava
-
this will allow only small letters (as in not numbers and symbols)
Code:
Private Sub Text1_KeyPress(KeyAscii As Integer)
If Chr$(KeyAscii) = UCase(Chr$(KeyAscii)) Then _
KeyAscii = 0
End Sub
this will allow small letters and numbers and symbols
Code:
Private Sub Text1_KeyPress(KeyAscii As Integer)
If Not (Chr$(KeyAscii) = LCase(Chr$(KeyAscii))) Then _
KeyAscii = 0
End Sub
hope it helps
-
Sorry I'm really stupid and missed your second question
you need to make your labels into a control array (call them all label1 but set the index properties from 1 to 7)
then this will work
[code]
Dim i As Integer
'Cut text1 to 7 letters long
If Len(Text1.Text) > 7 Then _
Text1.Text = Left(Text1.Text,7)
'Loop through letters in text1
For i = 1 To Len(Text1.Text)
Label1(i).Caption = Mid$(Text1.Text,i,1)
Next i
[code]
-
thank you, does anyone have the answer to question2?
-
sorry, I didn't see your reply to my second question, I forgot to click the refresh button before posting it
-
11 more question. How come it dosn't work, also it doesn't have anything to do label 2 and label 3 and etc.
-
are you sure, are you getting an error, or just nothing happening?
This might sound really stupid but I just wanna check what yu're doing
when I told you to make the labels into a control array what EXACTLY did you do?
-
I'm sorry, I didn't read the part that said to make an arry, becuase I printed it out, and it came up on lots of pages, and I needed to use it on another compter, thanks for the help, it all works now