Expected type mismatch error

vb6

I'm expecting a ByRef Argument Type Mismatch at compile time but I'm not getting it. It's compiling without errors and failing at runtime with error 13, "Type mismatch".

It's a fairly simple to reproduce.

dim c as Car
Set c = New Car

Sail c

Public Sub Sail(ByRef b As Boat)
    ...
End Sub

Car does not inherit from Boat

Is there a setting (or plugin perhaps) that will force VB into a strict compilation mode?

Edit: it looks like there's no compiler option for this. Does anyone know of an addon that analyses the source for these casting issues during a compile?

Best Answer

Is it possible to set Option Strict True in VB6?

Edit: Apparently it is not possible in VB6 (seems to have been introduced with VB 7.0)

Related Topic