I have a shared method into which I pass arrays of controls (mix of rectControls and containerControls) to effect alignment. I was previously using variant arrays and sometimes had problems when there was only one type of item in the array - the compiler would then seem to auto format as a array of the item’s type, rather than a variant array.
So instead I though I’d use an Object() array, thinking this would fix the problem as all the controls are subclasses of objects.
Dim objs() As object objs = Array(tbClosed, eDueDate) //where tbClosed is a canvas subclass and //eDueDate is a containterControl subclass
But now the compiler gives an error stating “Type mismatch error. Expected Object() but got Variant().” I suppose this is the compiler doing its thing again.
So I tested the alternative of:
Redim objs(-1) objs.append tbClosed objs.append eDueDate
This doesn’t give a compile error but would require a significant amount of re-coding on all the controls I have (100’s of controls).