Mega Code Archive

 
Categories / VB.Net Tutorial / GUI
 

Use With statement to set Form properties

Imports System.Windows.Forms public class FormWith    public Shared Sub Main     Dim Form2 As New Form()     With Form2       .Cursor = System.Windows.Forms.Cursors.Cross       .Enabled = True       .FormBorderStyle = FormBorderStyle.Sizable       .Height = 400       .HelpButton = True       .MaximizeBox = True       .MinimizeBox = True       .Name = "Form2"       .ShowInTaskbar = True       .StartPosition = FormStartPosition.CenterParent       .Text = "New Form"       .Width = 500       .WindowState = FormWindowState.Normal       .ShowDialog()     End With    End Sub End class