ben.oates
03-25-2008, 11:16 AM
Hello all,
I come here in desperation (after 2 hours on what should be a very simple bit of code!). I'm sure I must be missing something simple, but I really can't see what it is.
I have a custom type "orderHardware" and I want to find the location of an item in array of that custom type, but I get a Type Mismatch on the equals operator in the If statement below. Please see if you can offer any suggestions on this. I searched relentlessly for information on comparing custom types and came up empty.
Public Function hardwareExists(arr() As orderHardware, ordHardware As orderHardware) As Integer
For hardwareExists = LBound(arr) To UBound(arr)
'This is where the error occurs
If arr(hardwareExists) = ordHardware Then Exit Function
Next hardwareExists
End Function
Thanks for your help guys.
I come here in desperation (after 2 hours on what should be a very simple bit of code!). I'm sure I must be missing something simple, but I really can't see what it is.
I have a custom type "orderHardware" and I want to find the location of an item in array of that custom type, but I get a Type Mismatch on the equals operator in the If statement below. Please see if you can offer any suggestions on this. I searched relentlessly for information on comparing custom types and came up empty.
Public Function hardwareExists(arr() As orderHardware, ordHardware As orderHardware) As Integer
For hardwareExists = LBound(arr) To UBound(arr)
'This is where the error occurs
If arr(hardwareExists) = ordHardware Then Exit Function
Next hardwareExists
End Function
Thanks for your help guys.