I have a situation where i want to pass a object Type as a parameter for a comparison logic.
Example:
Sub Some (val as Control, typ as Type, ....)
...
if typeof val is typ then
...
end if
...
End Sub
I have found myself doing this logic pattern in multiple methods and want to condense the logic into one location instead of multiple spots, for simplification.
Is this the correct way of validating this type of structure or is there a better way of doing such things?
That didnt take long
If you want to abstract a comparison to be generic this should get you to the right logic.
Basically pass the object (val), can be variant if you want to take one step up of abstraction, and then if you know what the String value that will be returned for that Type then pass it as a String value
Working Example:
In code run:
Module Declaration:
Hope this helps anyone else that may need such abstraction.