I am trying to change the text color but received below error.
The property ‘SelectionColor’ cannot be found on this object. Verify that the property exists and can be set.
At C:\Users\Muhammad Suhail\Desktop\script\work\Patching Team\temp.ps1:72 char:9
You haven’t provided enough information for this forum to help you.
Without knowing what class of object $outputBox is, no one will be able to tell you if SelectionColor is a valid property and if it can be set or is read only.
The error implies that the property does not exist. You can check this by piping $outputBox to Get-Member
That should work fine with RichTextBox. In fact, after adding the addtional code necessary to create the form, your code works as expected and I don’t get the error you posted in your original post.
As previously advised, I would pipe $outputBox to Get-Member to check it’s the class of object you think it is.