Textbox Property not changing? Checkbox event

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Locked
User avatar
soccsupport
Posts: 17
Joined: Sun Mar 03, 2013 12:44 pm

Textbox Property not changing? Checkbox event

Post by soccsupport » Mon Apr 08, 2013 3:19 pm

I have a simple checkbox to enable or disable a textbox ReadOnly property. So in this case if I run my Form, check the box, it enables the textbox but if I uncheck the box it will not disable the textbox. I know I missing something simple here. Don't know if this matters but this is a TabControl window.
PowerShell Code
Double-click the code block to select all.
$RemotePS_CheckedChanged={
	#TODO: Place custom script here
	If ($RemotePS.CheckState -eq 'Unchecked')
		{ $RmServer.ReadOnly="True"
		Write-Host "Should be disabled"}
	Else
		{ $RmServer.ReadOnly="False" 
		Write-Host "Should be enabled"}
Thoughts or input? Thanks.

User avatar
jvierra
Posts: 13507
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Textbox Property not changing? Checkbox event

Post by jvierra » Mon Apr 08, 2013 3:29 pm

It is not a text value. ReadOnly is Boolean. You need to set it to $true or $false.

User avatar
soccsupport
Posts: 17
Joined: Sun Mar 03, 2013 12:44 pm

Re: Textbox Property not changing? Checkbox event

Post by soccsupport » Tue Apr 09, 2013 3:28 am

Jvierra,

Thank you for the info, was spot on. Thought it was something simple, I just need to keep that logical thinking in place. :mrgreen:

Locked