Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set a Textbox to allow multiple lines, and scrollability

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:

$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?

like image 675
M24Kermit Avatar asked Jan 04 '23 16:01

M24Kermit


1 Answers

$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".

like image 169
Bruce Vang Avatar answered Jan 13 '23 15:01

Bruce Vang