locked
Update Textbox in GUI Powershell RRS feed

  • Question

  • I have a Button in my GUI that is supposed to write Text in a Textbox. The Problem is that the Button is replacing existing text what is only supposed to happen when there is no "@" in the Textbox. This is what my code looks like

    Function SendAs
    {
    	
    	$SAUser = Get-ADUser -Filter * |Out-GridView -Passthru
    	$Axel = "Stoll"
    	$Userarray = @()
    	Foreach ($user in $SAUser){$Userarray  += ('@{0}' -f $user.SamAccountName)}
    	$saustext = $userarray -join " "
    	if($txtAccName.text -notcontains "@")
    	{$txtAccName.text = $saustext}
    	else 
    	{$txtAccName.text += $txtAccname.text + $saustext}
    }

    Friday, October 5, 2018 9:42 AM