Page 1 of 1

How do I add a line feed to a textbox control?

Posted: Fri Apr 05, 2013 10:26 am
by rkirchhof

Code: Select all

$buttonGetProxies_Click={
$file=$textbox1.text
$List=Get-Content $file
foreach ($User in $List){
$textbox2.Text = $Textbox2.text + ($User)
$Data = (Get-Mailbox $User -ea silentlycontinue | select-object DistinguishedName -Expandproperty EmailAddresses | select Proxyaddressstring | ft | Out-String)
if ($Data -like $null)
		{
		$textbox2.Text = $Textbox2.text + " Has no Proxy addresses." 
		}
else
	{
	$textbox2.Text = $Textbox2.text + $Data
	}
}
}
I need to add a line feed on this line $textbox2.Text = $Textbox2.text + " Has no Proxy addresses." I've tried 'r'n /r/n &chr(13) and everything else I can think of, but none of them work.

Re: How do I add a line feed to a textbox control?

Posted: Fri Apr 05, 2013 10:36 am
by davidc
Do you have the TextBox configured to use Multiline text?

See the Spotlight on the Text control for more info:

http://www.sapien.com/blog/2011/06/13/p ... x-control/

David

Re: How do I add a line feed to a textbox control?

Posted: Fri Apr 05, 2013 10:42 am
by rkirchhof
Yes I did enable multiline. I just tried this too.
$textbox2.AppendText(" Has no Proxy addresses.'r'n")
Taken straight from the link above and this is the output.

BEETRoot@cru.org Has no Proxy addresses.'r'npledgesupport@cru.org

this is what I wish to see:

BEETRoot@cru.org Has no Proxy addresses.
pledgesupport@cru.org

Re: How do I add a line feed to a textbox control?

Posted: Fri Apr 05, 2013 11:15 am
by davidc
I see the problem. You are using single quote instead of the backtick.

Try this:
PowerShell Code
Double-click the code block to select all.
$textbox2.AppendText(" Has no Proxy addresses.`r`n")
David

Re: How do I add a line feed to a textbox control?

Posted: Fri Apr 05, 2013 11:22 am
by rkirchhof
ARRGGGG! I feel Soooo Stupid! Thanks' a bunch! Of course that did it.