Results 1 to 8 of 8

Thread: 2 simple questions

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    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
    NXSupport - Your one-stop source for computer help

  2. #2
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    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

  3. #3
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    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]



  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    thank you, does anyone have the answer to question2?
    NXSupport - Your one-stop source for computer help

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    sorry, I didn't see your reply to my second question, I forgot to click the refresh button before posting it
    NXSupport - Your one-stop source for computer help

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    11 more question. How come it dosn't work, also it doesn't have anything to do label 2 and label 3 and etc.
    NXSupport - Your one-stop source for computer help

  7. #7
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    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?

  8. #8

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    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
    NXSupport - Your one-stop source for computer help

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width