vb.netwinformspropertiesform-designer

Starting properties of objects in Winforms form vb.net


In my software course, each time we submit an assignment, we have to include a document with the starting properties of each object in a form.

E.g.

TextBox1
Location: 241, 115
Name: TextBox1
Size: 100, 20
TabIndex: 0

It's a real pain to scroll through the properties viewer and copy and paste each customised value for 30+ objects on a form... I was wondering if there'd be an easy piece of code or way about getting an (at least partially) automated printout/view of all the properties of the objects.

Was thinking some sort of private sub I could past into the bottom of the program and run on load, that gets all objects, and outputs the non-default properties to a report or something? Basically any ideas on how I could do this?

Any help'd be great!


Solution

  • Why not look in the InitializeComponent Method, you should be able to cut and paste what you need from there.

    Private Sub InitializeComponent()
        Me.Button1 = New System.Windows.Forms.Button()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.SuspendLayout()
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(0, 0)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(75, 23)
        Me.Button1.TabIndex = 0
        Me.Button1.Text = "Button1"
        Me.Button1.UseVisualStyleBackColor = True
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.Location = New System.Drawing.Point(12, 46)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(51, 17)
        Me.Label1.TabIndex = 1
        Me.Label1.Text = "Label1"
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 16.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(282, 255)
        Me.Controls.Add(Me.Label1)
        Me.Controls.Add(Me.Button1)
        Me.Name = "Form1"
        Me.Text = "Form1"
        Me.ResumeLayout(False)
        Me.PerformLayout()
    
    End Sub