Results 1 to 6 of 6

Thread: Simple (Lowercase / uppercase) RESOLVED

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2005
    Posts
    300

    Simple (Lowercase / uppercase) RESOLVED

    I have three lists boxes.

    List1 - A list of words.

    ok i want to click a buttn and it will go down every word in list1 and if it contains a capital letters it gets added to list2 if it doesn';t it gets added to list1

    thanks in advance
    Last edited by Ricky1; Nov 21st, 2005 at 09:19 PM.
    Im Learning !!!!

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Simple (Lowercase / uppercase)

    Do you mean add it to List3?

    You could loop thru the listbox, and compare the item to the same Ucase() item, to see if they are the same. If one has a capital letter, then they won't be.

    You have List1 of words, and you want List2 to be lower case, and List3 to contain words with Capitals?

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2005
    Posts
    300

    Re: Simple (Lowercase / uppercase)

    yes.
    Im Learning !!!!

  4. #4
    Banned timeshifter's Avatar
    Join Date
    Mar 2004
    Location
    at my desk
    Posts
    2,465

    Re: Simple (Lowercase / uppercase)

    Loop through each item, and search it with a small loop.
    VB Code:
    1. For counter = 1 to Len(myWord)
    2.    If Asc(Mid$(myWord, counter)) >= 65 And Asc(Mid$(myWord, counter)) <= 90 Then
    3.       List2.AddItem myWord
    4.    End If
    5. Next counter

    or something like that.

  5. #5
    Banned timeshifter's Avatar
    Join Date
    Mar 2004
    Location
    at my desk
    Posts
    2,465

    Re: Simple (Lowercase / uppercase)

    The last post will put the uppercase ones into List2, but David's way is better..
    VB Code:
    1. If LCase(myWord) = myWord Then
    2.    List2.AddItem myWord
    3. Else
    4.    List3.AddItem myWord
    5. End If
    Puts any words with upper case letters in List 3, and all lower case words in list 2.

  6. #6
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Simple (Lowercase / uppercase)

    This should do it.
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Form_Load()
    4.   Dim x As Integer
    5.   For x = 0 To list1.ListCount - 1
    6.     If list1.List(x) = LCase(list1.List(x)) Then
    7.       list2.AddItem list1.List(x) ' all lowercase
    8.     Else
    9.       list3.AddItem list1.List(x) ' mixes case
    10.     End If
    11.   Next x
    12. End Sub

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