The requested page is not available for the requested platform. You are viewing the content for Default platform.

Inline With Statement (VB)

Inlines the object reference of this With statement into all dot-references.


By removing a With statement, you can make nested code context-independent. For rather small With statements, Inline With Statement (VB) can be used to unindent code and improve readability.


Available from the context menu or via shortcuts:

  • when the edit cursor or caret is on a With statement. The caret should be on the With statement's argument (an identifier).


Public Sub TestMethod()
    Dim objVar = New TestClassWith objVar
        .Prop1 = 10
        .Prop2 = 20
        .Prop3 = 30
    End With
End Sub


Public Sub TestMethod()
    Dim objVar = New TestClass
    objVar.Prop1 = 10
    objVar.Prop2 = 20
    objVar.Prop3 = 30
End Sub



See Also