is there a xojo equivilant to "with"

In VB there is a With command which allows short hand access to another window.


with  window1
end with

where .var1 is really “window1.var1”


so i tried that with a window and it did not work, i got errors.

Using MainWin
End Using

No there is no equivalent. Using lets you not specify module names when accessing proprieties, functions, and classes contained in them, but there is nothing like with from VB.

can you provide a code example of “Using”

Say you have a module with two classes Orange and Apple contained in a module called Fruit. Then in a method you could have either of the following:

Dim a as new Fruit.Apple


Using Fruit
Dim a as new Apple

Obviously this is a silly example, but it can be very useful when you have many modules being used together in a method and you don’t want to have to type out the same module name over and over. Hopefully that makes sense?

using isnt the equivalent of VB’s with

With is a interesting linguistic short cut until you try to nest WITH’s and then all hell breaks lose

When I did work in VB many many years ago for an MS premiere partner our rule was “DO NOT USE WITH”
Ever. Period. Full Stop.

Yes i Understand now

Thank you