Search found 13620 matches

by jvierra
Thu Jul 18, 2019 10:47 am
Forum: PowerShell GUIs
Topic: Problem getting the current BackColor of a textbox object
Replies: 17
Views: 432

Re: Problem getting the current BackColor of a textbox object

Just some added info that can be useful. Every control in WinForms has a property called “Tag”. This property is used to “tag” a control with extra information that is always available on the control. <control variable>.Tag = ‘any kind of object or value’ To access this baggage we can use “$this.Tag...
by jvierra
Thu Jul 18, 2019 12:38 am
Forum: PowerShell GUIs
Topic: Problem getting the current BackColor of a textbox object
Replies: 17
Views: 432

Re: Problem getting the current BackColor of a textbox object

Here is the documentation reference for the above methods: https://docs.microsoft.com/en-us/dotnet ... mework-4.8

It is inherited from "Control" and is available on very control in WinForms.
by jvierra
Thu Jul 18, 2019 12:35 am
Forum: PowerShell GUIs
Topic: Problem getting the current BackColor of a textbox object
Replies: 17
Views: 432

Re: Problem getting the current BackColor of a textbox object

There is a very simple way to reset the background or foreground color of any control. "ResetBackColor()" "ResetForeColor()" These methods will set the control to the original configured color. All of the variables neeed are already built into the controls. Here is a full demo. It takes only a coup...
by jvierra
Wed Jul 17, 2019 2:12 pm
Forum: PowerShell GUIs
Topic: Problem getting the current BackColor of a textbox object
Replies: 17
Views: 432

Re: Problem getting the current BackColor of a textbox object

Post the PSF of your test form. You are doing something odd somewhere.
by jvierra
Wed Jul 17, 2019 1:25 pm
Forum: PowerShell GUIs
Topic: Problem getting the current BackColor of a textbox object
Replies: 17
Views: 432

Re: Problem getting the current BackColor of a textbox object

Is it even possible to get windows to give us this value back? It is very hard to understand what you issue is. The variable will contain the current color object and it can ge re-assigned back to the control. Why do you think this is not working? If you want to know what is in the variable you can...
by jvierra
Wed Jul 17, 2019 1:09 pm
Forum: PowerShell GUIs
Topic: Problem getting the current BackColor of a textbox object
Replies: 17
Views: 432

Re: Problem getting the current BackColor of a textbox object

The code saves the color in the variable:

[b}$previousBackColor = $textbox1.BackColor[/b]

Why do you think this doesn't work? I use it all of the time.

Note that the object is not a string. It is a "System.Drawing.Color" object.
by jvierra
Tue Jul 16, 2019 1:58 pm
Forum: PowerShell GUIs
Topic: Application Packaging
Replies: 3
Views: 116

Re: Application Packaging

You would have to customize the installer for that to happen.

Look at the Sapien blog articles on installing packaged scripts and modules.
by jvierra
Tue Jul 16, 2019 12:39 pm
Forum: PowerShell GUIs
Topic: Application Packaging
Replies: 3
Views: 116

Re: Application Packaging

You can just copy the folder to the folder that the script runs in as a subfolder and load it using an explicit path. It is also possible to create a module project and use it to create an installer for the module.

All of this assumes a module that does not require specific custom installation.
by jvierra
Tue Jul 09, 2019 3:24 pm
Forum: PowerShell GUIs
Topic: uncheck a check with a command and not trigger an event
Replies: 5
Views: 284

Re: uncheck a check with a command and not trigger an event

Disabling a checkbox does not disable events. It only disables the UI. Look at my same. The answer is much easier than you think. Also - "Refresh()" is not necessary. $checkbox1_CheckedChanged={ if(-not $setting){ Write-Host 'changed' } } $safeSetting_Click={ $setting = $true $checkbox1.Checked = -n...
by jvierra
Tue Jul 09, 2019 1:11 pm
Forum: Windows PowerShell
Topic: Run code block as different user
Replies: 1
Views: 480

Re: Run code block as different user

You can't use MessageBox in a job script. This would be the correct way to do this: Write-Log "Creating an autologon user named $($textbox_Build_PCName.Text).$($currentMinistry.Domain) in $($combobox_Build_MinistryList.Text)" $Credential = Get-Credential ***\**** #User with rights in AD $sb = { para...