VB.NET Code Formatting Demo


FormatCode Code Formatter is based on serveral powerful syntax parser engines so you can exactly control the appearance of your source code. Here is the code formatting demo of FormatCode VB.NET Code Formatter to prove the ability of code formatting functions of FormatCode:

   '--- Before Code Formatting ---

   Public Class Form1
   Inherits System.Windows.Forms.Form
   #Region " Windows Form Designer generated code "
   Public Sub New()
   MyBase.New()
   'This call is required by the Windows Form Designer.
   InitializeComponent()
   'Add any initialization after the InitializeComponent() call
   End Sub
   'Form overrides dispose to clean up the component list.
   Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
   If disposing Then
   If Not (components Is Nothing) Then
   components.Dispose()
   End If
   End If
   MyBase.Dispose(disposing)
   End Sub
   Dim intElapsedTime(2) As Integer
   Private Sub Timer1_Tick(ByVal sender As System.Object) Handles Timer1.Tick
   Dim intIndex1 As Integer
   Dim intIndex2 As Integer
   intElapsedTime(0) += 1
   txtTime1.Text = CStr(intElapsedTime(0))
   Select Case intElapsedTime(0)
   Case 10
   System.Windows.Forms.MessageBox.Show("I love timers!")
   Case 20
   lblPleaseWait.Visible = True
   lblPleaseWait.Refresh()
   For intIndex1 = 0 To 30000
   For intIndex2 = 0 To 30000
   Next intIndex2
   Next intIndex1
   lblPleaseWait.Visible = False
   Case 30
   lblPleaseWait.Visible = True
   lblPleaseWait.Refresh()
   For intIndex1 = 0 To 30000
   For intIndex2 = 0 To 30000
   Next intIndex2
   Application.DoEvents()
   Next intIndex1
   lblPleaseWait.Visible = False
   Case Else
   End Select
   End Sub
   Private Sub Timer2_Tick(ByVal sender As System.Object) Handles Timer2.Tick
   intElapsedTime(1) += 1
   txtTime2.Text = CStr(intElapsedTime(1))
   End Sub
   End Class


   '--- After Code Formatting ---

   Public Class Form1
       Inherits System.Windows.Forms.Form

   #Region " Windows Form Designer generated code "

       Public Sub New()
           MyBase.New()

           'This call is required by the Windows Form Designer.
           InitializeComponent()

           'Add any initialization after the InitializeComponent() call

       End Sub

       'Form overrides dispose to clean up the component list.
       Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
           If disposing Then
               If Not (components Is Nothing) Then
                   components.Dispose()
               End If
           End If
           MyBase.Dispose(disposing)
       End Sub

       Dim intElapsedTime(2) As Integer


       Private Sub Timer1_Tick(ByVal sender As System.Object) Handles Timer1.Tick
           Dim intIndex1 As Integer
           Dim intIndex2 As Integer

           intElapsedTime(0) += 1
           txtTime1.Text = CStr(intElapsedTime(0))
           Select Case intElapsedTime(0)
               Case 10
                   System.Windows.Forms.MessageBox.Show("I love timers!")
               Case 20
                   lblPleaseWait.Visible = True
                   lblPleaseWait.Refresh()
                   For intIndex1 = 0 To 30000
                       For intIndex2 = 0 To 30000
                       Next intIndex2
                   Next intIndex1
                   lblPleaseWait.Visible = False
               Case 30
                   lblPleaseWait.Visible = True
                   lblPleaseWait.Refresh()
                   For intIndex1 = 0 To 30000
                       For intIndex2 = 0 To 30000
                       Next intIndex2
                       Application.DoEvents()
                   Next intIndex1
                   lblPleaseWait.Visible = False
               Case Else
           End Select
       End Sub

       Private Sub Timer2_Tick(ByVal sender As System.Object) Handles Timer2.Tick
           intElapsedTime(1) += 1
           txtTime2.Text = CStr(intElapsedTime(1))
       End Sub

   End Class


Click here to preview the VB.NET Code Formatting Demo 2.

With FormatCode VB.NET Code Formatters, you can format and transform any foreign VB.NET source code to meet your preferred coding style or any common code convention in several seconds!