Question:
I am returning multiple different sizes of strings into a box.
I have used a System.Windows.Forms.Label
but unfortunately some of the strings are too large for it, and do not display.
I have tried replacing it with a System.Windows.Forms.TextBox
but it will not let me set the height of it past 1 line, even with multiline set to true, and scrollbars set:
1 2 3 4 5 6 7 |
$objTextBox1 = New-Object System.Windows.Forms.TextBox $objTextBox1.Multiline = True; $objTextBox1.Location = New-Object System.Drawing.Size(150,10) $objTextBox1.Size = New-Object System.Drawing.Size(300,200) $objTextBox1.Scrollbars = Scrollbars.Vertical $objForm1.Controls.Add($objTextBox1) |
Is there anything I’m missing here?
Answer:
1 2 3 4 5 6 7 |
$objTextBox1 = New-Object System.Windows.Forms.TextBox $objTextBox1.Multiline = $True; $objTextBox1.Location = New-Object System.Drawing.Size(150,10) $objTextBox1.Size = New-Object System.Drawing.Size(300,200) $objTextBox1.Scrollbars = "Vertical" $objForm1.Controls.Add($objTextBox1) |
Options for Scrollbars can be “Vertical”, “Horizontal”, or “Both”.