Author Posts

December 5, 2016 at 12:55 pm

Hi, what is the easiest way to check if the text in a textbox ($textbox1) contains a word like _DOM1 and have it stop there if it contains _DOM1? I use something similar to check if the textbox is empty: Thanks for any help in advance.

if ($textbox1.textLength -eq 0) { $statusbar1.text = " ACTIVE GROUP BOX IS EMPTY " }
	else
	{ 

December 5, 2016 at 7:00 pm

When you are using a .NET GUI, your first line of defense should be form validation. Here is one implementation on StackOverflow:

http://stackoverflow.com/questions/32744858/powershell-forms-how-to-validate-different-types-of-system-windows-forms-togeth

That post is doing validation on specific events being triggered, like the text changing. You can also do it on submit to validated everything is correct before calling other functions in your code.