Just discovered that if not connected does not work (connected is a function returning a boolean). You need to use if connected=false VB supports both versions. Would be nice if B4A could do the same.