Textbox.text

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of Rob Simmers Rob Simmers 5 months, 3 weeks ago.

  • Author
    Posts
  • #59374
    Profile photo of Tony Rodal
    Tony Rodal
    Participant

    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
    	{ 
    
    
    
  • #59416
    Profile photo of Rob Simmers
    Rob Simmers
    Participant

    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.

You must be logged in to reply to this topic.