PowerShell GUI component variables isolated from one another

Welcome Forums General PowerShell Q&A PowerShell GUI component variables isolated from one another

This topic contains 1 reply, has 2 voices, and was last updated by

 
Participant
9 months, 2 weeks ago.

  • Author
    Posts
  • #100336

    Participant
    Points: 12
    Rank: Member

    I am a newbie at working with PowerShell GUIs and I am working on something now that has me a bit confused.

    What I need help with is how to get a button component's associated action variable to see another component's?

    For example, if I have a button titled "Do Something" and I have a Date Time Picker component and I want to use the date from the Date Time Picker in my "Do Something" button's variable, how would I go about this?

    So, something like this:

    $DoSomething_Button_Click {
    [System.Windows.MessageBox]::Show("$Date_DateTimePicker",0,'Information')
    }

    I guess I am not able to add an image here, so I will just redirect to another post I have asking the same thing on TechNet here:
    https://social.technet.microsoft.com/Forums/windowsserver/en-US/a485728d-35cd-4b9b-a5dd-e44899fb1eb3/powershell-gui-component-variables-isolated-from-one-another?forum=winserverpowershell

    Thanks for your help on this, much appreciated.

  • #100423

    Participant
    Points: 43
    Rank: Member

    You can use $Date_DateTimePicker.Value in your message box. The Value property of DateTimePicker is a DateTime object.

    MSDN: DateTimePicker.Value

    At that point, you can manipulate the value like any other DateTime object in PowerShell, including outputting just the date as a string. You just need to know the format you want to use.

The topic ‘PowerShell GUI component variables isolated from one another’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort