Use With statement with Form object : With statement « Statements « VB.Net Tutorial

Imports System.Drawing
Imports System.Windows.Forms

Public Class WithForm : Inherits Form
   Public Shared Sub Main()
      Dim frm as New Form
      With frm
         .BackColor = Color.Gray
         .ForeColor = Color.Red
         .Text = "The With Statement"
         .Enabled = True
         .Topmost = True
         .MinimizeBox = False
      End With
   End Sub
End Class

4.5.With statement
4.5.1.Use With statement with Form object
4.5.2.Insert statement into With statement
4.5.3.Nested With statement
4.5.4.Use With statement with OpenFileDialog