Page 1 of 1

textbox

Posted: Fri Oct 26, 2018 7:52 am
by mqh777
On a powershell studio form we use text boxes so users can enter data. Is there a way to show shadow text in the text box saying what to enter? Example if the Textbox was for "computer name" to display enter computer name in the textbox so they know what to enter?

Re: textbox

Posted: Fri Oct 26, 2018 8:25 am
by mxtrinidad
In the Textbox control, use the Text property to enter a text to be display when it initially open the forms.
Other than that, you could add code to keep displaying the text after it get's process.

Re: textbox

Posted: Fri Oct 26, 2018 8:32 am
by davidc
You can use the TextBox - Watermark control set:

https://www.sapien.com/blog/2013/08/14/new-control-set-textbox-watermark/

Re: textbox

Posted: Fri Oct 26, 2018 2:39 pm
by mqh777
Thanks, I read that webpage. I'm unclear on where you place all of this code. Is it on the properties of the textbox? Or under "form load"? Or both?

Re: textbox

Posted: Fri Oct 26, 2018 2:56 pm
by jvierra
What code. Just add the watermark textbox to the form from the toolbox. The watermark can be set on the properties browser tab "Tab" property or in code anywhere you need to set it.

Code: Select all

$Watermark_Leave={
	if($this.Text -eq "")
	{
		#Display the watermark
		$this.Text = $this.Tag # or assign a different source here
		$this.ForeColor = 'LightGray'
	}
}