Results 1 to 4 of 4

Thread: my next task

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2000
    Posts
    17

    Unhappy

    i made a program that let a user enter a five-digit Integer and it is supost to print how many integers are 7's. I can do this but i am supost to use a loop and im not good with them at all. Mine never seem to stop any suggestions...

  2. #2
    Fanatic Member
    Join Date
    Feb 2000
    Location
    The Netherlands
    Posts
    715
    Post your code, maybe someone can help.
    Oetje
    oetje@home.nl
    93606776
    Visual Basic 6, Windows 2000

    Never pet a burning dog

  3. #3
    Addicted Member c@lle's Avatar
    Join Date
    Oct 1999
    Location
    Belgium
    Posts
    179
    make a form with a textbox and a commandbutton. Then use following code:

    Code:
    Private Sub Command1_Click()
     Dim lPos As Long
     Dim iCount As Integer
     
     Const strToFind = "7"
     
        'start searching
        lPos = InStr(1, Text1.Text, strToFind)
        
        Do While lPos > 0
            iCount = iCount + 1
            'change start position of find function to 'lPos'
            lPos = InStr(lPos + 1, Text1.Text, strToFind)
        Loop
        
        MsgBox "I found " & iCount & " times digit " & strToFind & " in " & Text1.Text & "."
    End Sub

  4. #4
    Guest
    wouldnt have a clue
    but could u help us out with the phone thing?

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