Please please save my life and help


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: Please please save my life and help

  1. #1
    Join Date
    Aug 2004
    Posts
    43,023

    Please please save my life and help

    [Originally posted by fun lvn crmnl]

    Hi, this is a bit cheeky but what it is is that I'm at night college right now doin a visual basic test and everythin's gone straight out of my head and I don't have any help sheets or anythin and I was wonderin if any of you lot would possibly be able to save my life and give me a hand? If you do I would be MASSIVELY gratefull. Anyway first off if you are kind enough to help me (please?) I have one text box and two labels. The first label has to count how many vowels there is in the text box and display it. the second label has to count how many lines in the text box there are. I also have to have it so it will automaticly convert the vowles into cappitals. Any help would be MASSIVELY appreciated. Thanks if you can help in anyway.


  2. #2
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Please please save my life and help

    [Originally posted by Dustin]

    You meant Listbox, not textbox, rite?
    Here you go:
    Q2. Label2.caption = Listbox1.ListCount


  3. #3
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Re:Please please save my life and help

    [Originally posted by fun lvn crmnl]

    No mate a text box it is, I have to count the lines of text, I think I've got that one sorted though. Cheers for helpin anyway you're a star :)

  4. #4
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Re:Re:Please please save my life and help

    [Originally posted by Dustin]

    Ok, Label1.caption = Text1.Height then

  5. #5
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Please please save my life and help

    [Originally posted by neophile]

    Option Explicit

    Private Sub Text1_Change()
    Dim lCount As Long
    Dim i As Integer
    For i = 1 To 5
    lCount = lCount + FindCount(Text1.Text, Mid("AEIOU", i, 1))
    Next
    Label1.Caption = CStr(lCount) & " vowel(s)"
    Label2.Caption = CStr(FindCount(Text1.Text, vbCrLf) + 1) & " line(s)"
    End Sub

    Private Sub Text1_KeyPress(KeyAscii As Integer)
    Select Case KeyAscii
    Case 97, 101, 105, 111, 117
    KeyAscii = KeyAscii - 32
    Debug.Print KeyAscii
    End Select
    End Sub

    Private Function FindCount(ByVal Text As String, ByVal Find As String) As Long
    Dim lPos As Long
    lPos = InStr(1, Text, Find, vbTextCompare)
    While lPos > 0
    FindCount = FindCount + 1
    lPos = InStr(lPos + 1, Text, Find, vbTextCompare)
    Wend
    End Function



    ... I hope this helps ;)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center