Disable button exception.

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 4 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
MIC-23145632
Posts: 14
Last visit: Tue Apr 28, 2020 11:25 pm

Disable button exception.

Post 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 986 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 114 times
Thanks
  1. function Fc-cr-ButtonDisable-CkeckAccount
  2. {
  3.     $button_cr_CheckAccount.Enabled = $false
  4. }
  1. function Fn-Cr-CheckADUser
  2. {
  3.        
  4.     Fn-Cr-RadioButtonSelectCheck
  5.  
  6.     if ($global:cr_SamAccount.Length -ge 3)
  7.     {
  8.         try
  9.         {
  10.         Write-Host "Try"
  11.         $temp_ck = Get-ADUser -Identity $global:cr_SamAccount -ErrorAction Stop
  12.         }
  13.         catch
  14.         {
  15.             Fc-cr-ClearProcessView
  16.             Fc-cr-ButtonDisable-CkeckAccount
  17.             $button_cr_CreateAccount.Enabled = $true
  18.             Write-Host "Catch"
  19.         }
  20.  
  21.         if (!$error)
  22.         {
  23.             Write-Host "IF no err"
  24.             $button_cr_CreateAccount.Enabled = $false
  25.             $richtextbox_cr_ProcessView.Text = "帳號重複"
  26.             if ($global:cr_RadioButtonSelect -match "LineInput")
  27.             {
  28.                 $groupbox_cr_LineInput.Enabled = $true
  29.                 #$textbox_cr_LineInputSource.Enabled = $true
  30.             }
  31.  
  32.         }
  33.  
  34.     }
  35. }
  36.  
  1. $button_cr_CheckAccount_Click={
  2.     #TODO: Place custom script here
  3.     $groupbox_cr_LineInput.Enabled = $false
  4.     $groupbox_cr_StdInput.Enabled = $false
  5.     Fn-Cr-CheckADUser
  6. }
User avatar
Alexander Riedel
Posts: 8478
Last visit: Tue Mar 26, 2024 8:52 am
Answers: 19
Been upvoted: 37 times

Re: Disable button exception.

Post by Alexander Riedel »

[Topic moved by moderator]
Alexander Riedel
SAPIEN Technologies, Inc.
This topic is 4 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked