Hi,

Iam trying the following code for searching a ListBox Control.
VB Code:
  1. Const LB_FINDSTRING = &H18F
  2. Private Declare Function SendMessage Lib "User32" _
  3. Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As _
  4. Integer, ByVal wParam As Integer, lParam As Any) As Long
  5.  
  6. iListIndex = SendMessage(m_listOfChangedDO.hWnd, LB_FINDSTRING, -1, ByVal strName(i))

If I do a sample application, Iam getting the result correctly, but if I include this code in my application it crashes saying an error:

VB6 caused a general protection fault
in module USER.EXE at 000c:00003ebb

Is there something wrong here? Or is there any better way to search a string in a ListBox?

Thanks,
Pres/.