i have problem in user combo controle

mzia
mzia used Ask the Experts™
on
I have written a custom active x controle in vb 6 which is internally combobox controle of vb and i have added few methods in it.The problems is that it works fine except when i set focus on that controle by moving through tab key it just don't responds  for few moments and shut down without  prompting any error.By moving with mouse it works fine.
//////////Here is the code of controle which i have written
Option Explicit
'This controle is for storing hiden string ID behinds its each item,AS usually
'itemdata stores integer id,I have customs properties ID to store string id,and also
' method named GetIDIndex which returns the id of that index,except this i uses
' the same properties and methods as vb combo have,
' Author :-M Zia Ul Haq.
'
'
'
'
Private pID() As String
Private tempID() As String
Private pItemCount As Long
'Event Declarations:
Event Click() 'MappingInfo=cboComboControle,cboComboControle,-1,Click
Event DblClick() 'MappingInfo=cboComboControle,cboComboControle,-1,DblClick
Event KeyDown(KeyCode As Integer, Shift As Integer) 'MappingInfo=cboComboControle,cboComboControle,-1,KeyDown
Event KeyPress(KeyAscii As Integer) 'MappingInfo=cboComboControle,cboComboControle,-1,KeyPress
Event KeyUp(KeyCode As Integer, Shift As Integer) 'MappingInfo=cboComboControle,cboComboControle,-1,KeyUp
Event Change() 'MappingInfo=cboComboControle,cboComboControle,-1,Change
Event DropDown() 'MappingInfo=cboComboControle,cboComboControle,-1,DropDown
Event OLECompleteDrag(Effect As Long) 'MappingInfo=cboComboControle,cboComboControle,-1,OLECompleteDrag
Event OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single) 'MappingInfo=cboComboControle,cboComboControle,-1,OLEDragDrop
Event OLEDragOver(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single, State As Integer) 'MappingInfo=cboComboControle,cboComboControle,-1,OLEDragOver
Event OLEGiveFeedback(Effect As Long, DefaultCursors As Boolean) 'MappingInfo=cboComboControle,cboComboControle,-1,OLEGiveFeedback
Event OLESetData(Data As DataObject, DataFormat As Integer) 'MappingInfo=cboComboControle,cboComboControle,-1,OLESetData
Event OLEStartDrag(Data As DataObject, AllowedEffects As Long) 'MappingInfo=cboComboControle,cboComboControle,-1,OLEStartDrag
Event Scroll() 'MappingInfo=cboComboControle,cboComboControle,-1,Scroll
Event Validate(Cancel As Boolean) 'MappingInfo=cboComboControle,cboComboControle,-1,Validate
Public Function GetIDIndex(ID As String) As Long
'this method return the index of id and if not found then returns -1
GetIDIndex = -1
Dim lngCount As Long
For lngCount = 0 To cboComboControle.ListCount - 1
If StrComp(pID(lngCount), ID, vbTextCompare) = 0 Then
GetIDIndex = lngCount
Exit Function
End If
Next lngCount
End Function
Public Property Let ID(index As Long, value As String)
'this properties stores a string id againsta item
 On Error GoTo ErrLine
If Not Trim(value) = "" Then 'if not ID empty
pID(index) = value
PropertyChanged "ID"
Exit Property
Else
GoTo ErrLine ' if ID is a null string then raise error
End If
Exit Property
ErrLine:
If Err.Number = 0 Then
Err.Description = "Empty String Not Allowed as ID"
Err.Raise vbObjectError + 11101, "User ComboBox Controle", Err.Description
Else
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End If
End Property
Private Sub ResetIDSubscript()
'this method reset the array subscript and make it larger
'if it reaches near to the initial size of array
On Error GoTo ErrLine
Dim lnglstCount  As Long
ReDim tempID(pItemCount)
tempID = pID
pItemCount = pItemCount + 200
ReDim pID(pItemCount)
For lnglstCount = 0 To cboComboControle.ListCount - 1
pID(lnglstCount) = tempID(lnglstCount)
Next lnglstCount
ReDim tempID(1)
Exit Sub
ErrLine:
ErrorHandler
End Sub
Public Property Get ID(index As Long) As String
'this methods gets the ID against the item
On Error GoTo ErrLine
If Not Trim(pID(index)) = "" Then
ID = pID(index)
Else
GoTo ErrLine 'if array is empty mean ID not stored so raise error
End If
Exit Property
ErrLine:
If Err.Number = 0 Then
Err.Description = "ID Not Found in the Collection."
Err.Raise vbObjectError + 11102, Err.Source, Err.Description
Else
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End If
End Property
Private Sub UserControl_Initialize()
'Initializes the array used to storer string id intitially to 300
On Error GoTo ErrLine
pItemCount = 300
ReDim pID(pItemCount)
Me.Clear
Exit Sub
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End Sub
Private Sub UserControl_Resize()
'Resizes the combo box as controle resizes
 On Error Resume Next
If Width < 400 Then
Width = 300
End If
cboComboControle.Move 0, 0, Width
If Font.Size >= 8 And Font.Size < 10 Then
Height = 350
ElseIf Font.Size >= 10 And Font.Size < 12 Then
Height = 395
ElseIf Font.Size >= 12 And Font.Size < 14 Then
Height = 455
ElseIf Font.Size >= 14 And Font.Size < 18 Then
Height = 515
ElseIf Font.Size >= 18 And Font.Size < 24 Then
Height = 590
ElseIf Font.Size >= 24 Then
Height = 710
End If
End Sub


'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=cboComboControle,cboComboControle,-1,BackColor
Public Property Get BackColor() As OLE_COLOR
On Error GoTo ErrLine
   BackColor = cboComboControle.BackColor
   Exit Property
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End Property

Public Property Let BackColor(ByVal New_BackColor As OLE_COLOR)
On Error GoTo ErrLine
   cboComboControle.BackColor() = New_BackColor
   PropertyChanged "BackColor"
   Exit Property
ErrLine:
ErrorHandler
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=cboComboControle,cboComboControle,-1,ForeColor
Public Property Get ForeColor() As OLE_COLOR
On Error GoTo ErrLine
   ForeColor = cboComboControle.ForeColor
   Exit Property
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End Property

Public Property Let ForeColor(ByVal New_ForeColor As OLE_COLOR)
On Error GoTo ErrLine
   cboComboControle.ForeColor() = New_ForeColor
   PropertyChanged "ForeColor"
   Exit Property
ErrLine:
ErrorHandler
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=cboComboControle,cboComboControle,-1,Enabled
Public Property Get Enabled() As Boolean
On Error GoTo ErrLine
   Enabled = cboComboControle.Enabled
   Exit Property
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End Property

Public Property Let Enabled(ByVal New_Enabled As Boolean)
 On Error GoTo ErrLine
   cboComboControle.Enabled() = New_Enabled
   PropertyChanged "Enabled"
   Exit Property
ErrLine:
ErrorHandler
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=cboComboControle,cboComboControle,-1,Font
Public Property Get Font() As Font
 On Error GoTo ErrLine
   Set Font = cboComboControle.Font
   Exit Property
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End Property

Public Property Set Font(ByVal New_Font As Font)
 On Error GoTo ErrLine
   Set cboComboControle.Font = New_Font
   PropertyChanged "Font"
      UserControl_Resize
      Exit Property
ErrLine:
ErrorHandler

End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=cboComboControle,cboComboControle,-1,Refresh
Public Sub Refresh()
 On Error GoTo ErrLine
   cboComboControle.Refresh
   Exit Sub
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End Sub

Private Sub cboComboControle_Click()
 On Error GoTo ErrLine
   RaiseEvent Click
   Exit Sub
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description

End Sub

Private Sub cboComboControle_DblClick()
 On Error GoTo ErrLine
   RaiseEvent DblClick
   Exit Sub
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description

End Sub

Private Sub cboComboControle_KeyDown(KeyCode As Integer, Shift As Integer)
 On Error GoTo ErrLine
   RaiseEvent KeyDown(KeyCode, Shift)
   Exit Sub
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description

End Sub

Private Sub cboComboControle_KeyPress(KeyAscii As Integer)
 On Error GoTo ErrLine
   RaiseEvent KeyPress(KeyAscii)
   Exit Sub
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End Sub

Private Sub cboComboControle_KeyUp(KeyCode As Integer, Shift As Integer)
 On Error GoTo ErrLine
   RaiseEvent KeyUp(KeyCode, Shift)
   Exit Sub
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description

End Sub

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=cboComboControle,cboComboControle,-1,AddItem
Public Sub AddItem(ByVal Item As String, Optional ByVal index As Variant)
   On Error GoTo ErrLine
   If cboComboControle.ListCount > pItemCount - 15 Then ResetIDSubscript
       cboComboControle.AddItem Item, index
   Exit Sub
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description

End Sub

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=cboComboControle,cboComboControle,-1,Appearance
Public Property Get Appearance() As Integer
 On Error GoTo ErrLine
   Appearance = cboComboControle.Appearance
   Exit Property
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End Property

Public Property Let Appearance(ByVal New_Appearance As Integer)
 On Error GoTo ErrLine
   cboComboControle.Appearance() = New_Appearance
   PropertyChanged "Appearance"
   Exit Property
ErrLine:
ErrorHandler
End Property

Private Sub cboComboControle_Change()
 On Error GoTo ErrLine
   RaiseEvent Change
   Exit Sub
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End Sub

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=cboComboControle,cboComboControle,-1,Clear
Public Sub Clear()
 On Error GoTo ErrLine
   cboComboControle.Clear
   pID(0) = ""
   Exit Sub
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End Sub

Private Sub cboComboControle_DropDown()
 On Error GoTo ErrLine
   RaiseEvent DropDown
   Exit Sub
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End Sub

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=cboComboControle,cboComboControle,-1,FontBold
Public Property Get FontBold() As Boolean
 On Error GoTo ErrLine
   FontBold = cboComboControle.FontBold
   Exit Property
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End Property

Public Property Let FontBold(ByVal New_FontBold As Boolean)
 On Error GoTo ErrLine
   cboComboControle.FontBold() = New_FontBold
   PropertyChanged "FontBold"
   Exit Property
ErrLine:
ErrorHandler

End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=cboComboControle,cboComboControle,-1,FontItalic
Public Property Get FontItalic() As Boolean
 On Error GoTo ErrLine
   FontItalic = cboComboControle.FontItalic
   Exit Property
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End Property

Public Property Let FontItalic(ByVal New_FontItalic As Boolean)
 On Error GoTo ErrLine
   cboComboControle.FontItalic() = New_FontItalic
   PropertyChanged "FontItalic"
   Exit Property
ErrLine:
ErrorHandler

End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=cboComboControle,cboComboControle,-1,FontName
Public Property Get FontName() As String
 On Error GoTo ErrLine
   FontName = cboComboControle.FontName
   Exit Property
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description

End Property

Public Property Let FontName(ByVal New_FontName As String)
 On Error GoTo ErrLine
   cboComboControle.FontName() = New_FontName
   PropertyChanged "FontName"
   Exit Property
ErrLine:
ErrorHandler

End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=cboComboControle,cboComboControle,-1,FontSize
Public Property Get FontSize() As Single
 On Error GoTo ErrLine
   FontSize = cboComboControle.FontSize
   Exit Property
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End Property

Public Property Let FontSize(ByVal New_FontSize As Single)
 On Error GoTo ErrLine
If New_FontSize > 28 Then New_FontSize = 28
   cboComboControle.FontSize() = New_FontSize
   PropertyChanged "FontSize"
   UserControl_Resize
   Exit Property
ErrLine:
ErrorHandler
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=cboComboControle,cboComboControle,-1,FontStrikethru
Public Property Get FontStrikethru() As Boolean
 On Error GoTo ErrLine
   FontStrikethru = cboComboControle.FontStrikethru
   Exit Property
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End Property

Public Property Let FontStrikethru(ByVal New_FontStrikethru As Boolean)
 On Error GoTo ErrLine
   cboComboControle.FontStrikethru() = New_FontStrikethru
   PropertyChanged "FontStrikethru"
   Exit Property
ErrLine:
ErrorHandler
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=cboComboControle,cboComboControle,-1,FontUnderline
Public Property Get FontUnderline() As Boolean
 On Error GoTo ErrLine
   FontUnderline = cboComboControle.FontUnderline
   Exit Property
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End Property

Public Property Let FontUnderline(ByVal New_FontUnderline As Boolean)
 On Error GoTo ErrLine
   cboComboControle.FontUnderline() = New_FontUnderline
   PropertyChanged "FontUnderline"
   Exit Property
ErrLine:
ErrorHandler
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=cboComboControle,cboComboControle,-1,hWnd
Public Property Get hWnd() As Long
 On Error GoTo ErrLine
   hWnd = cboComboControle.hWnd
   Exit Property
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description

End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=cboComboControle,cboComboControle,-1,ItemData
Public Property Get ItemData(ByVal index As Integer) As Long
 On Error GoTo ErrLine
   ItemData = cboComboControle.ItemData(index)
   Exit Property
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description

End Property

Public Property Let ItemData(ByVal index As Integer, ByVal New_ItemData As Long)
 On Error GoTo ErrLine
   cboComboControle.ItemData(index) = New_ItemData
   PropertyChanged "ItemData"
   Exit Property
ErrLine:
ErrorHandler

End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=cboComboControle,cboComboControle,-1,List
Public Property Get List(ByVal index As Integer) As String
 On Error GoTo ErrLine
   List = cboComboControle.List(index)
   Exit Property
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description

End Property

Public Property Let List(ByVal index As Integer, ByVal New_List As String)
 On Error GoTo ErrLine
   cboComboControle.List(index) = New_List
   PropertyChanged "List"
   Exit Property
ErrLine:
ErrorHandler
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=cboComboControle,cboComboControle,-1,ListCount
Public Property Get ListCount() As Integer
 On Error GoTo ErrLine
   ListCount = cboComboControle.ListCount
   Exit Property
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=cboComboControle,cboComboControle,-1,ListIndex
Public Property Get ListIndex() As Integer
 On Error GoTo ErrLine
   ListIndex = cboComboControle.ListIndex
   Exit Property
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description

End Property

Public Property Let ListIndex(ByVal New_ListIndex As Integer)
 On Error GoTo ErrLine
   cboComboControle.ListIndex() = New_ListIndex
   PropertyChanged "ListIndex"
   Exit Property
ErrLine:
   ErrorHandler
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=cboComboControle,cboComboControle,-1,Locked
Public Property Get Locked() As Boolean
 On Error GoTo ErrLine
   Locked = cboComboControle.Locked
   Exit Property
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description

End Property

Public Property Let Locked(ByVal New_Locked As Boolean)
 On Error GoTo ErrLine
   cboComboControle.Locked() = New_Locked
   PropertyChanged "Locked"
   Exit Property
ErrLine:
ErrorHandler

End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=cboComboControle,cboComboControle,-1,MouseIcon
Public Property Get MouseIcon() As Picture
 On Error GoTo ErrLine
   Set MouseIcon = cboComboControle.MouseIcon
   Exit Property
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End Property

Public Property Set MouseIcon(ByVal New_MouseIcon As Picture)
 On Error GoTo ErrLine
   Set cboComboControle.MouseIcon = New_MouseIcon
   PropertyChanged "MouseIcon"
   Exit Property
ErrLine:
ErrorHandler
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=cboComboControle,cboComboControle,-1,MousePointer
Public Property Get MousePointer() As Integer
 On Error GoTo ErrLine
   MousePointer = cboComboControle.MousePointer
   Exit Property
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End Property

Public Property Let MousePointer(ByVal New_MousePointer As Integer)
 On Error GoTo ErrLine
   cboComboControle.MousePointer() = New_MousePointer
   PropertyChanged "MousePointer"
   Exit Property
ErrLine:
ErrorHandler

End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=cboComboControle,cboComboControle,-1,NewIndex
Public Property Get NewIndex() As Integer
 On Error GoTo ErrLine
   NewIndex = cboComboControle.NewIndex
   Exit Property
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description

End Property

Private Sub cboComboControle_OLECompleteDrag(Effect As Long)
 On Error GoTo ErrLine
   RaiseEvent OLECompleteDrag(Effect)
   Exit Sub
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End Sub

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=cboComboControle,cboComboControle,-1,OLEDrag
Public Sub OLEDrag()
 On Error GoTo ErrLine
   cboComboControle.OLEDrag
   Exit Sub
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End Sub

Private Sub cboComboControle_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
 On Error GoTo ErrLine
   RaiseEvent OLEDragDrop(Data, Effect, Button, Shift, X, Y)
   Exit Sub
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End Sub

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=cboComboControle,cboComboControle,-1,OLEDragMode
Public Property Get OLEDragMode() As Integer
 On Error GoTo ErrLine
   OLEDragMode = cboComboControle.OLEDragMode
   Exit Property
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End Property
Public Property Let OLEDragMode(ByVal New_OLEDragMode As Integer)
 On Error GoTo ErrLine
   cboComboControle.OLEDragMode() = New_OLEDragMode
   PropertyChanged "OLEDragMode"
   Exit Property
ErrLine:
ErrorHandler
End Property

Private Sub cboComboControle_OLEDragOver(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single, State As Integer)
 On Error GoTo ErrLine
   RaiseEvent OLEDragOver(Data, Effect, Button, Shift, X, Y, State)
   Exit Sub
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End Sub

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=cboComboControle,cboComboControle,-1,OLEDropMode
Public Property Get OLEDropMode() As Integer
 On Error GoTo ErrLine
   OLEDropMode = cboComboControle.OLEDropMode
   Exit Property
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description

End Property

Public Property Let OLEDropMode(ByVal New_OLEDropMode As Integer)
 On Error GoTo ErrLine
   cboComboControle.OLEDropMode() = New_OLEDropMode
   PropertyChanged "OLEDropMode"
   Exit Property
ErrLine:
ErrorHandler

End Property

Private Sub cboComboControle_OLEGiveFeedback(Effect As Long, DefaultCursors As Boolean)
 On Error GoTo ErrLine
   RaiseEvent OLEGiveFeedback(Effect, DefaultCursors)
   Exit Sub
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End Sub

Private Sub cboComboControle_OLESetData(Data As DataObject, DataFormat As Integer)
 On Error GoTo ErrLine
   RaiseEvent OLESetData(Data, DataFormat)
   Exit Sub
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End Sub

Private Sub cboComboControle_OLEStartDrag(Data As DataObject, AllowedEffects As Long)
 On Error GoTo ErrLine
   RaiseEvent OLEStartDrag(Data, AllowedEffects)
   Exit Sub
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End Sub

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=cboComboControle,cboComboControle,-1,RemoveItem
Public Sub RemoveItem(ByVal index As Integer)
 On Error GoTo ErrLine
 Dim lngCount As Long
   cboComboControle.RemoveItem index
   For lngCount = index To cboComboControle.ListCount 'As item removed so to remove its id as well
   pID(lngCount) = pID(lngCount + 1) 'Remove the id of removed item by overwritting the id of next item  and resets the other ids as well
   Next lngCount
   Exit Sub
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End Sub

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=cboComboControle,cboComboControle,-1,RightToLeft
Public Property Get RightToLeft() As Boolean
 On Error GoTo ErrLine
   RightToLeft = cboComboControle.RightToLeft
   Exit Property
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End Property

Public Property Let RightToLeft(ByVal New_RightToLeft As Boolean)
 On Error GoTo ErrLine
   cboComboControle.RightToLeft() = New_RightToLeft
   PropertyChanged "RightToLeft"
   Exit Property
ErrLine:
ErrorHandler
End Property

Private Sub cboComboControle_Scroll()
 On Error GoTo ErrLine
   RaiseEvent Scroll
   Exit Sub
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End Sub

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=cboComboControle,cboComboControle,-1,SelLength
Public Property Get SelLength() As Long
' On Error GoTo ErrLine
'   SelLength = cboComboControle.SelLength
End Property

Public Property Let SelLength(ByVal New_SelLength As Long)
 On Error GoTo ErrLine
   cboComboControle.SelLength() = New_SelLength
   PropertyChanged "SelLength"
   Exit Property
ErrLine:
ErrorHandler
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=cboComboControle,cboComboControle,-1,SelStart
Public Property Get SelStart() As Long
' On Error GoTo ErrLine
'   SelStart = cboComboControle.SelStart
End Property

Public Property Let SelStart(ByVal New_SelStart As Long)
 On Error GoTo ErrLine
   cboComboControle.SelStart() = New_SelStart
   PropertyChanged "SelStart"
   Exit Property
ErrLine:
ErrorHandler

End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=cboComboControle,cboComboControle,-1,SelText
Public Property Get SelText() As String
' On Error GoTo ErrLine
'   SelText = cboComboControle.SelText
End Property
Public Property Let SelText(ByVal New_SelText As String)
 On Error GoTo ErrLine
   cboComboControle.SelText() = New_SelText
   PropertyChanged "SelText"
   Exit Property
ErrLine:
ErrorHandler

End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=cboComboControle,cboComboControle,-1,Sorted
Public Property Get Sorted() As Boolean
 On Error GoTo ErrLine
   Sorted = cboComboControle.Sorted
   Exit Property
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=cboComboControle,cboComboControle,-1,Style
Public Property Get Style() As Integer
 On Error GoTo ErrLine
   Style = cboComboControle.Style
   Exit Property
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End Property


'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=cboComboControle,cboComboControle,-1,Text
Public Property Get Text() As String
 On Error GoTo ErrLine
   Text = cboComboControle.Text
   Exit Property
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End Property

Public Property Let Text(ByVal New_Text As String)
 On Error GoTo ErrLine
   cboComboControle.Text() = New_Text
   PropertyChanged "Text"
   Exit Property
ErrLine:
ErrorHandler
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=cboComboControle,cboComboControle,-1,ToolTipText
Public Property Get ToolTipText() As String
 On Error GoTo ErrLine
   ToolTipText = cboComboControle.ToolTipText
   Exit Property
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End Property
Public Property Let ToolTipText(ByVal New_ToolTipText As String)
 On Error GoTo ErrLine
   cboComboControle.ToolTipText() = New_ToolTipText
   PropertyChanged "ToolTipText"
   Exit Property
ErrLine:
ErrorHandler
End Property
'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=cboComboControle,cboComboControle,-1,TopIndex
Public Property Get TopIndex() As Integer
 On Error GoTo ErrLine
   TopIndex = cboComboControle.TopIndex
   Exit Property
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End Property
Public Property Let TopIndex(ByVal New_TopIndex As Integer)
 On Error GoTo ErrLine
   cboComboControle.TopIndex() = New_TopIndex
   PropertyChanged "TopIndex"
   Exit Property
ErrLine:
ErrorHandler
End Property

Private Sub cboComboControle_Validate(Cancel As Boolean)
 On Error GoTo ErrLine
   RaiseEvent Validate(Cancel)
   Exit Sub
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End Sub

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=cboComboControle,cboComboControle,-1,WhatsThisHelpID
Public Property Get WhatsThisHelpID() As Long
 On Error GoTo ErrLine
   WhatsThisHelpID = cboComboControle.WhatsThisHelpID
   Exit Property
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End Property

Public Property Let WhatsThisHelpID(ByVal New_WhatsThisHelpID As Long)
 On Error GoTo ErrLine
   cboComboControle.WhatsThisHelpID() = New_WhatsThisHelpID
   PropertyChanged "WhatsThisHelpID"
   Exit Property
ErrLine:
ErrorHandler

End Property
'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MemberInfo=13

'Load property values from storage
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
 On Error GoTo ErrLine
Dim index As Integer
   cboComboControle.BackColor = PropBag.ReadProperty("BackColor", &H80000005)
   cboComboControle.ForeColor = PropBag.ReadProperty("ForeColor", &H80000008)
   cboComboControle.Enabled = PropBag.ReadProperty("Enabled", True)
   Set cboComboControle.Font = PropBag.ReadProperty("Font", Ambient.Font)
   cboComboControle.Appearance = PropBag.ReadProperty("Appearance", 1)
   cboComboControle.FontBold = PropBag.ReadProperty("FontBold", 0)
   cboComboControle.FontItalic = PropBag.ReadProperty("FontItalic", 0)
'   cboComboControle.FontName = PropBag.ReadProperty("FontName", "")
'   cboComboControle.FontSize = PropBag.ReadProperty("FontSize", 0)
   cboComboControle.FontStrikethru = PropBag.ReadProperty("FontStrikethru", 0)
   cboComboControle.FontUnderline = PropBag.ReadProperty("FontUnderline", 0)
'TO DO: The member you have mapped to contains an array of data.
'   You must supply the code to persist the array.  A prototype
'   line is shown next:
'   cboComboControle.ItemData(Index) = PropBag.ReadProperty("ItemData" & Index, 0)
'TO DO: The member you have mapped to contains an array of data.
'   You must supply the code to persist the array.  A prototype
'   line is shown next:
  'cboComboControle.List(index) = PropBag.ReadProperty("List" & index, "")
   cboComboControle.ListIndex = PropBag.ReadProperty("ListIndex", 0)
   cboComboControle.Locked = PropBag.ReadProperty("Locked", False)
   Set MouseIcon = PropBag.ReadProperty("MouseIcon", Nothing)
   cboComboControle.MousePointer = PropBag.ReadProperty("MousePointer", 0)
   cboComboControle.OLEDragMode = PropBag.ReadProperty("OLEDragMode", 0)
   cboComboControle.OLEDropMode = PropBag.ReadProperty("OLEDropMode", 0)
   cboComboControle.RightToLeft = PropBag.ReadProperty("RightToLeft", False)
'   cboComboControle.SelLength = PropBag.ReadProperty("SelLength", 0)
'   cboComboControle.SelStart = PropBag.ReadProperty("SelStart", 0)
'   cboComboControle.SelText = PropBag.ReadProperty("SelText", "")
'   cboComboControle.Text = PropBag.ReadProperty("Text", "Combo1")
   cboComboControle.ToolTipText = PropBag.ReadProperty("ToolTipText", "")
'   cboComboControle.TopIndex = PropBag.ReadProperty("TopIndex", 0)
   cboComboControle.WhatsThisHelpID = PropBag.ReadProperty("WhatsThisHelpID", 0)
   Exit Sub
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End Sub


'Write property values to storage
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
 On Error GoTo ErrLine
Dim index As Integer

   Call PropBag.WriteProperty("BackColor", cboComboControle.BackColor, &H80000005)
   Call PropBag.WriteProperty("ForeColor", cboComboControle.ForeColor, &H80000008)
   Call PropBag.WriteProperty("Enabled", cboComboControle.Enabled, True)
   Call PropBag.WriteProperty("Font", cboComboControle.Font, Ambient.Font)
   Call PropBag.WriteProperty("Appearance", cboComboControle.Appearance, 1)
   Call PropBag.WriteProperty("FontBold", cboComboControle.FontBold, 0)
   Call PropBag.WriteProperty("FontItalic", cboComboControle.FontItalic, 0)
   Call PropBag.WriteProperty("FontName", cboComboControle.FontName, "")
   Call PropBag.WriteProperty("FontSize", cboComboControle.FontSize, 0)
   Call PropBag.WriteProperty("FontStrikethru", cboComboControle.FontStrikethru, 0)
   Call PropBag.WriteProperty("FontUnderline", cboComboControle.FontUnderline, 0)
'TO DO: The member you have mapped to contains an array of data.
'   You must supply the code to persist the array.  A prototype
'   line is shown next:
  ' Call PropBag.WriteProperty("ItemData" & index, cboComboControle.ItemData(index), 0)
'TO DO: The member you have mapped to contains an array of data.
'   You must supply the code to persist the array.  A prototype
'   line is shown next:
   'Call PropBag.WriteProperty("List" & index, cboComboControle.List(index), "")
   Call PropBag.WriteProperty("ListIndex", cboComboControle.ListIndex, 0)
   Call PropBag.WriteProperty("Locked", cboComboControle.Locked, False)
   Call PropBag.WriteProperty("MouseIcon", MouseIcon, Nothing)
   Call PropBag.WriteProperty("MousePointer", cboComboControle.MousePointer, 0)
   Call PropBag.WriteProperty("OLEDragMode", cboComboControle.OLEDragMode, 0)
   Call PropBag.WriteProperty("OLEDropMode", cboComboControle.OLEDropMode, 0)
   Call PropBag.WriteProperty("RightToLeft", cboComboControle.RightToLeft, False)
'   Call PropBag.WriteProperty("SelLength", cboComboControle.SelLength, 0)
'   Call PropBag.WriteProperty("SelStart", cboComboControle.SelStart, 0)
'   Call PropBag.WriteProperty("SelText", cboComboControle.SelText, "")
   Call PropBag.WriteProperty("Text", cboComboControle.Text, "Combo1")
   Call PropBag.WriteProperty("ToolTipText", cboComboControle.ToolTipText, "")
   Call PropBag.WriteProperty("TopIndex", cboComboControle.TopIndex, 0)
   Call PropBag.WriteProperty("WhatsThisHelpID", cboComboControle.WhatsThisHelpID, 0)
   Exit Sub
ErrLine:
Err.Raise Err.Number, "User ComboBox Controle", Err.Description
End Sub

Private Sub ErrorHandler()
'Give error message on producing error
MsgBox Err.Description, vbMsgBoxHelpButton + vbCritical, "User ComboBox Controle Error", Err.HelpFile, Err.HelpContext
End Sub
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Éric MoreauSenior .Net Consultant
Top Expert 2016

Commented:
can't you trace to try to find the problem?

Commented:
it's hard shooting from the hip.  Looking at your code makes life a lot easier.

Jon
Author of the Year 2009

Commented:
Hi mzia,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Refund points and save as a 0-pt PAQ.

mzia, Please DO NOT accept THIS comment as an answer.
EXPERTS: Post a comment if you are certain that an expert deserves credit.  Explain why.
==========
DanRollins -- EE database cleanup volunteer
Commented:
Hi EveryBody,
Sorry its being too long that my question is on the forum and hav't recieved too much responses.ANd the responses i recieved does't solved my problem.So  I tried to solve the problem myself as no response from the forum and then
at last I fond the solution the solution was to just set the proprty "CausesValidation" to False of the activex control
and it works .....
Thanks
Zia

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial