tgmdbm
tgmdbm

Reputation: 1563

expected type mismatch error

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?

Upvotes: 2

Views: 777

Answers (1)

TheTXI
TheTXI

Reputation: 37905

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)

Upvotes: 3

Related Questions