>In FoxPro, I can call a function with macro substitution. I have to use a very long Select Case statement in VB6 to accomplish the same thing. Is there a more efficient way to do this in VB6? (See examples below):
>
>Thanks,
>
>Dan
>
>FoxPro Code:
>SCAN
> lcMethodName = "ST+states.stcode+"()"
> DO &lcMethodName && Load the map polygon
> =DrawPolygon(@laMap)
>ENDSCAN
>
>Visual Basic 6 Code:
>For iCntr = 1 To UBound(pvarMap,1)
> Select Case pvarMap(iCntr,mapMethodName)
> Case "1100"
> pvarMap = USMap.St1100(dxAxis,dyAxis)
> Case "1110"
> pvarMap = USMap.St1110(dxAxis,dyAxis)
> Case "1120"
> pvarMap = USMap.St1120(dxAxis,dyAxis)
>
> End Select
> DrawPolygon(ByRef pvarMap As Variant)
>Next
Check for the CallByName function. Be advise that flexibility that it offers is at the cost of performance!
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com