Page 1 of 1

Disable button exception.

Posted: Mon Apr 29, 2019 1:37 am
by MIC-23145632
To help you better we need some information from you.

*** Please fill in the fields below. If you leave fields empty or specify 'latest' rather than the actual version your answer will be Product: PowerShell Studio 2019 (64 Bit)
Build: v5.6.162
OS: Windows Server 2012 R2 Standard (64 Bit)
Build: v6.3.9600.0

*** Please add details and screenshots as needed below. ***

HI All
I disabled the button from the setting and cleared the other textbox.
May I ask what I did wrong?
snipaste_20190429_163931.PNG
snipaste_20190429_163931.PNG (26.34 KiB) Viewed 495 times
My English is not good and may not be clear.
So I recorded a video of the execution process.
Video_2019-04-29_162926.zip
(1.27 MiB) Downloaded 43 times
Thanks
  1. function Fc-cr-ButtonDisable-CkeckAccount
  2.  
  3. {
  4.  
  5.     $button_cr_CheckAccount.Enabled = $false
  6.  
  7. }
  1. function Fn-Cr-CheckADUser
  2.  
  3. {
  4.  
  5.        
  6.  
  7.     Fn-Cr-RadioButtonSelectCheck
  8.  
  9.  
  10.  
  11.     if ($global:cr_SamAccount.Length -ge 3)
  12.  
  13.     {
  14.  
  15.         try
  16.  
  17.         {
  18.  
  19.         Write-Host "Try"
  20.  
  21.         $temp_ck = Get-ADUser -Identity $global:cr_SamAccount -ErrorAction Stop
  22.  
  23.         }
  24.  
  25.         catch
  26.  
  27.         {
  28.  
  29.             Fc-cr-ClearProcessView
  30.  
  31.             Fc-cr-ButtonDisable-CkeckAccount
  32.  
  33.             $button_cr_CreateAccount.Enabled = $true
  34.  
  35.             Write-Host "Catch"
  36.  
  37.         }
  38.  
  39.  
  40.  
  41.         if (!$error)
  42.  
  43.         {
  44.  
  45.             Write-Host "IF no err"
  46.  
  47.             $button_cr_CreateAccount.Enabled = $false
  48.  
  49.             $richtextbox_cr_ProcessView.Text = "帳號重複"
  50.  
  51.             if ($global:cr_RadioButtonSelect -match "LineInput")
  52.  
  53.             {
  54.  
  55.                 $groupbox_cr_LineInput.Enabled = $true
  56.  
  57.                 #$textbox_cr_LineInputSource.Enabled = $true
  58.  
  59.             }
  60.  
  61.  
  62.  
  63.         }
  64.  
  65.  
  66.  
  67.     }
  68.  
  69. }
  70.  
  71.  
  1. $button_cr_CheckAccount_Click={
  2.  
  3.     #TODO: Place custom script here
  4.  
  5.     $groupbox_cr_LineInput.Enabled = $false
  6.  
  7.     $groupbox_cr_StdInput.Enabled = $false
  8.  
  9.     Fn-Cr-CheckADUser
  10.  
  11. }

Re: Disable button exception.

Posted: Mon Apr 29, 2019 7:13 am
by Alexander Riedel
[Topic moved by moderator]