Getting a script to write to variable text boxes.

Welcome Forums General PowerShell Q&A Getting a script to write to variable text boxes.

This topic contains 2 replies, has 2 voices, and was last updated by

6 months, 3 weeks ago.

  • Author
  • #103535

    Points: -6
    Rank: Member

    Hi all,

    I am in the process of creating a GUI for our service desk, and I am trying to get it to be all fancy and have different elements depending on the task they are trying to carry out.

    Let's say I have two Group Boxes, each with a set of text boxes.
    I have one function, "Check-UserInfo", which I would like to be able to receive inout from either of those group boxes.
    The Click command is so:

    $GUIFindButton.Add_Click({Check-UserInfo -USRName $GUIUsernameTextBox.text -ProgressBox $GUIProgressRichTextBox -UserNameBox $GUIUsernameTextBox})

    And the function is so:

    Function Check-UserInfo {
    	Param (
    	$ProgressBox.Text = "Cogitating...`n"
    	$ProgressBox.Text += "Please stand by..."
    	sleep -m 5
    	IF (Get-Aduser -Filter {NAME -like $USRName})
    		$USR = Get-Aduser -Filter {NAME -like $USRName} -Properties *
    		$USR = Get-Aduser -Filter {SamAccountName -like $USRName} -Properties *
    	IF (($USR|measure).Count -GT 0)
    		$ProgressBox.Text = "Found $(($USR|Measure).count)...`nPlease stand by while useful information is collected and displayed..."
    		ForEach ($User in $USR)
    			$SamID = $User.SamAccountName
    			$ProgressBox.Text += Get-RBUser $SamID | Out-String
    	ELSEIF (($USR|measure).Count -LT 1)
    		$ProgressBox.Text = "No such User.`nPlease Try again"

    I gather that it is not happy about me trying to pass the name of my elements to it.
    Is this even possible? I was looking at whether $This might be a solution, but it doesn't seem like it.

    Any help would be appreciated.

  • #103703

    Points: 1,811
    Helping HandTeam Member
    Rank: Community Hero

    Since I can't run your code, can you provide a bit more info on which line isn't working, and what it isn't doing that you want it to do?

  • #112747

    Points: -6
    Rank: Member

    Hi, thanks for the reply, I must have missed the email that told me I had a reply, sorry :-/


    I ended up creating separate elements for each task, and I can't actually remember now what it was I was trying to do here...

The topic ‘Getting a script to write to variable text boxes.’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort