Results 1 to 2 of 2

Thread: Need help with SendMessage & Array

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2001
    Location
    Maumelle, AR
    Posts
    624

    Need help with SendMessage & Array

    VB Code:
    1. For i = 1 To ListView1.ListItems.Count
    2. x = SendMessage(File1.hwnd, LB_FINDSTRING, -1, ByVal ListView1.ListItems.Item)
    3.             If x = -1 Then 'item is NOT found in filelistbox
    4.             strRemoved = ListView1.SelectedItem.Text

    Well, here's what I've got to start with, and here's what I'm trying to do:

    Compare each listitem in my listview to each item in my filelistbox. Then if the item in the listview is NOT found in the filelistbox, I want to log it to an array or something. After this is done, I will build an array from my existing textfile, search the new array for any lines containing the items I logged to my "removed" array, and remove the lines from the array. Then I will build a new textfile with the updated array. Any help with this is appreciated. I can do the array searching, but I'm trying to figure out how to make an array that contains all of the items that weren't found.

  2. #2
    Frenzied Member Microbasic's Avatar
    Join Date
    Mar 2001
    Posts
    1,402
    VB Code:
    1. 'GENERAL_DECLARATIONS
    2. Dim arry As Variant
    3.  
    4. 'CODE
    5. Dim numitm As Long
    6. 'your other declarations here.
    7.  
    8. 'Any code before searching here
    9.  
    10. For i = 1 To ListView1.ListItems.Count
    11.     x = SendMessage(File1.hWnd, LB_FINDSTRING, -1, ByVal ListView1.ListItems.Item)
    12.     If x = -1 Then 'item is NOT found in filelistbox
    13.     strremoved = ListView1.SelectedItem.Text
    14.     numitm = numitm + 1
    15.     ReDim Preserve arry(numitm) As String
    16.     arry(numitm) = strremoved
    17.    
    18.     'anything else you need to do here
    19. Next
    20.  
    21. 'Any other code here


    MicroBasic
    Dragon Shadow Trainer

    There is no good or evil in the world...only programmers and fools .

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