Results 1 to 4 of 4

Thread: Code Placement ***Resolved***

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2002
    Location
    Edinburgh, Scotland, UK
    Posts
    14

    Code Placement ***Resolved***

    I have to compare two lists of numbers to see if there is a match at all, if there is a match I have to award one point, if there is 2, I award two and so on...I have a program and the code to do it but I do not know where to place the code in order to carry out the process and how to display the number of points. Here is the code I was given and the program is attached:

    Dim lngRetVal As Long
    Dim intWins As Integer
    Dim intIndex As Integer
    Dim strPrize As String

    For intIndex = 0 To lstUser.ListCount - 1
    lngRetVal = SendMessageString(lstComp.hwnd, _
    LB_FINDSTRING, -1&, _
    lstUser.List(intIndex))
    ' lngRetVal is the ListIndex
    If lngRetVal > -1& Then
    intWins = intWins + 1
    End If
    Next

    If intWins = 1 Then
    strPrize = " prize."
    Else
    strPrize = " prizes."
    End If

    MsgBox "There was " & intWins & " match: you have won " & intWins & strPrize
    Attached Files Attached Files
    Last edited by jacobite; Dec 12th, 2002 at 01:15 PM.
    Jacobite

  2. #2
    Lively Member da_haCKEr's Avatar
    Join Date
    Oct 2002
    Location
    Paradise Isle of Sri Lanka
    Posts
    116

    Question Uhhh ?

    I can't understand what you want to do, but the code is pretty clear. It uses the sendMessage API call to see if there's a match in the other list. I am not very familiar with this API call although I know what it does But I think there's no way to count number of matching terms using this API. It only shows whether there's a match.
    You can do a simple searching routine that's similar to the searching used in insertion sort.
    .:JanuZ:.
    .:JanuZ:.XtremeSoft


  3. #3

  4. #4

    Thread Starter
    New Member
    Join Date
    Dec 2002
    Location
    Edinburgh, Scotland, UK
    Posts
    14

    *** Resolved ***

    Yeh this has been resolved too. Thanks
    Jacobite

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