Search found 12675 matches

by jvierra
Tue Sep 25, 2018 2:10 am
Forum: Windows PowerShell
Topic: EXE Form - overwrite itself
Replies: 1
Views: 38

Re: EXE Form - overwrite itself

Simple. Download file to new location. Schedule a job to copy the new file over old file and exit. Job can restart the EXE with new file after copy. Note that PSS uses a separate executable to do this which is also easy. If a new file is detected start the second exe and exit current version. The "i...
by jvierra
Mon Sep 24, 2018 7:41 am
Forum: Windows PowerShell
Topic: EXE - Exit (close) Actions
Replies: 9
Views: 193

Re: EXE - Exit (close) Actions

I discovered on issue. You cannot run any PowerShell code in this event or after it. Only simple C# code can be run. This is because the pipeline has already been terminated when the event is called. You can write to the console but you cannot read from it. You can use any basic C# code to log to a ...
by jvierra
Mon Sep 24, 2018 2:51 am
Forum: PowerShell GUIs
Topic: POSH-SSH module is not functioning from a button press on a form
Replies: 6
Views: 111

Re: POSH-SSH module is not functioning from a button press on a form

What did you expect? Did you get to a breakpoint? Do you understand how to use the debugger in PSS?
by jvierra
Sun Sep 23, 2018 11:04 pm
Forum: PowerShell GUIs
Topic: SCVVM Command freezing in Forms
Replies: 6
Views: 95

Re: SCVVM Command freezing in Forms

Have you tried to run this under the debugger? What line is it blocking on?
by jvierra
Sat Sep 22, 2018 8:10 am
Forum: Windows PowerShell
Topic: EXE - Exit (close) Actions
Replies: 9
Views: 193

Re: EXE - Exit (close) Actions

You will not do much because it only calls C# code. I posted it to show that the events can be caught and handled within a PowerShell console. I am now trying to add an event generator to allow the code to generate an object event. This will allow the use of "Register-ObjectEvent" to cause the C# co...
by jvierra
Fri Sep 21, 2018 11:38 pm
Forum: Windows PowerShell
Topic: EXE - Exit (close) Actions
Replies: 9
Views: 193

Re: EXE - Exit (close) Actions

Here is an example of how to trap the close events in a PowerShell console. $code = @' using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Runtime.InteropServices; namespace Win32API{ public class CloseHandler{ //static bool exit...
by jvierra
Fri Sep 21, 2018 3:44 pm
Forum: PowerShell GUIs
Topic: Textbox cursor position is reset after programmatically changed text property
Replies: 9
Views: 115

Re: Textbox cursor position is reset after programmatically changed text property

Another thing to consider for per-character validation is the MaskedTextBox control which, when combined with the "KeyPress" event allows for simple pre-validation.

Without a purpose for this it is impossible to advise on the correct controls and methods for accomplishing the end purpose.
by jvierra
Fri Sep 21, 2018 2:38 pm
Forum: PowerShell GUIs
Topic: Textbox cursor position is reset after programmatically changed text property
Replies: 9
Views: 115

Re: Textbox cursor position is reset after programmatically changed text property

Place you code in the following event:

Code: Select all

$textbox1_KeyPress=[System.Windows.Forms.KeyPressEventHandler]{
#Event Argument: $_ = [System.Windows.Forms.KeyPressEventArgs]
	
}
[code]
by jvierra
Fri Sep 21, 2018 2:14 pm
Forum: PowerShell GUIs
Topic: Form stuck in minimized state while loop running?
Replies: 9
Views: 163

Re: Form stuck in minimized state while loop running?

I would also note that "DoEvents" can be useful it will also cause issues when run in a tight blocking loop. Doing this is really a design failure and it should be avoided. Designing with forms can be challenging and requires a good understanding of the Forms model and the event a behavior models. A...
by jvierra
Fri Sep 21, 2018 2:03 pm
Forum: PowerShell GUIs
Topic: Textbox cursor position is reset after programmatically changed text property
Replies: 9
Views: 115

Re: Textbox cursor position is reset after programmatically changed text property

To dynamically edit a textbox we usually use the keystroke events check each character.

The problem with TextChanged is that changing the text from this event causes a recursive chain of events that is very hard to control.