Drekko
Drekko

Reputation: 69

My line break is not working in my text box

Spent a few hours now and google and unable to find out why this is not working

When i put a `n or `r it breaks the line but you cannot see the line its blank

I am new to PowerShell I got this script from the net and I am trying to modify it a bit

#==< StatusGroupBox >============================================================
$StatusGroupBox = New-Object System.Windows.Forms.GroupBox
$StatusGroupBox.Location = New-Object System.Drawing.Point(3, 220)
$StatusGroupBox.Size = New-Object System.Drawing.Size(272, 50)
$StatusGroupBox.TabStop = $True
$StatusGroupBox.Text = "Status"
#==< StatusBoxOutput >===========================================================
$StatusBoxOutput = New-Object System.Windows.Forms.Label
$StatusBoxOutput.BorderStyle = [System.Windows.Forms.BorderStyle]::None
$StatusBoxOutput.Font = New-Object System.Drawing.Font("Tahoma", 8.25, [System.Drawing.FontStyle]::Regular, `
                        [System.Drawing.GraphicsUnit]::Point, ([System.Byte](0)))
$StatusBoxOutput.Location = New-Object System.Drawing.Point(6, 235)
$StatusBoxOutput.Size = New-Object System.Drawing.Size(266, 14)
$StatusBoxOutput.Text = ""
$StatusBoxOutput.TextAlign = [System.Drawing.ContentAlignment]::MiddleCenter
$StatusBoxOutput.BackColor = [System.Drawing.SystemColors]::Menu
$StatusBoxOutput.ForeColor = "Black"
# Check if Computer Name is in FQDN format. (We want the FQDN so we can get the Domain Name.)
if ($ComputerName -notlike "*.*") {
        # Change Status Message.
        $AdmPasswordOutput.Text = "error"
        $PasswordExpiresOutput.Text = "n/a"
        $StatusBoxOutput.ForeColor = "Red"
        $StatusBoxOutput.Text = "Name must be a FQDN `ne.g. pc1$DefaultComputerFQDN'"
        $SearchButton.Enabled = $true # Enable Search button
        return
}

Upvotes: 0

Views: 1037

Answers (1)

Joel Coehoorn
Joel Coehoorn

Reputation: 415921

You have to set the Multiline property to true on the textbox. They are single line by default.

Upvotes: 1

Related Questions