Page 1 of 1

Change color in output to TextBox depending on error or not

Posted: Thu Apr 03, 2014 4:37 am
by twp111
Hi,
I'm new to GUI-powershell scripts. Have made a GUI in Primal Forms for an AD-script I use to handle group-members. I log what happens to a TextBox ($LogBox). Now I would like to change the color of the log dependin if I get an error or not.

Have tried to search this forum and google it but cant find anything that would help me.

I can change color of everything in the textbox with $LogBox.forecolor = "red" but that is not what i want. I just want to change specific lines in the textbox. Not everything!

ex:
PowerShell Code
Double-click the code block to select all.
$LogBox.AppendText("***Error! Conputer: $Computer could not be found i AD"+[char]13+[char]10)
Can anyone please help me with an example of how to make the line above be written in RED?

Re: Change color in output to TextBox depending on error or

Posted: Thu Apr 03, 2014 2:53 pm
by boyddt_co
I'm running into the same issue and it appears that the text box sees all text as the same, more or less like Notepad. I'm still sorting things out but it looks like I'll be creating a large number of smaller text boxes so that I can manipulate the text individually based on current status.

Re: Change color in output to TextBox depending on error or

Posted: Thu Apr 03, 2014 3:05 pm
by twp111
boyddt_co wrote:I'm running into the same issue and it appears that the text box sees all text as the same, more or less like Notepad. I'm still sorting things out but it looks like I'll be creating a large number of smaller text boxes so that I can manipulate the text individually based on current status.
Hm, that doesn't sound good. Im pretty shore that I have seen it done but can't find the scrip. Mabe it wasn't primal forms. How about I you try the richtextbox or whatever it's name is? There have to be a solution to this! :)