Search found 12093 matches

by jvierra
Fri Apr 13, 2018 1:31 pm
Forum: PowerShell GUIs
Topic: DateTimePicker Format
Replies: 2
Views: 192

Re: DateTimePicker Format

$datetimepicker1.Value.ToLongDateString()

For all controls use the context menu on the control in the toolbox to access the documentation.

There is a link to almost all online MSDN documentation for each control.

https://msdn.microsoft.com/en-us/librar ... icker.aspx
by jvierra
Fri Apr 13, 2018 8:10 am
Forum: PowerShell GUIs
Topic: Manage Project Variables in a GUI?
Replies: 1
Views: 154

Re: Manage Project Variables in a GUI?

What is the question? What is it that you do not know how to do?
by jvierra
Thu Apr 12, 2018 6:52 am
Forum: Windows PowerShell
Topic: Executing Remote Script
Replies: 10
Views: 361

Re: Executing Remote Script

You don't need or want "Invoke-Expression".

Code: Select all

$RemotePC = 'Local-PC'
$sb = {
param($Arg0,$Arg1)
    C:\Scripts\foo.ps1 -arg0 $Arg0 -arg1 $Arg1
} 
Invoke-Command -ComputerName $RemotePC -ScriptBlock $sb -ArgumentList $Arg0,$Arg1
by jvierra
Wed Apr 11, 2018 7:04 pm
Forum: PowerShell GUIs
Topic: Change back color of cell based on two conditions
Replies: 1
Views: 174

Re: Change back color of cell based on two conditions

Yu will have to use a row level event to do this

A row is
$DataGridView.Rows[$_.RowIndex]

The columns are:
$DataGridView.Rows[$_.RowIndex].Cells['column name']

To access two cells just reference them by name as above.
by jvierra
Wed Apr 11, 2018 8:08 am
Forum: PowerShell GUIs
Topic: Datagridview selected cells
Replies: 6
Views: 203

Re: Datagridview selected cells

What is the issue.? The code enumerates all cells selected.
To access a cell on a click use the "CellClick" or "CellContentClick" event. The event object contains the cell column and row indexes.
by jvierra
Wed Apr 11, 2018 7:35 am
Forum: PowerShell GUIs
Topic: Datagridview selected cells
Replies: 6
Views: 203

Re: Datagridview selected cells

You need to use the property as there is no method with that name. Look closely at the documentation.

foreach($item in $datagridview1.SelectedCells){
Do stuff
}


There is no "SelectedCells()"
by jvierra
Wed Apr 11, 2018 7:16 am
Forum: PowerShell GUIs
Topic: Datagridview selected cells
Replies: 6
Views: 203

Re: Datagridview selected cells

This depends on the configuration of the grid.
by jvierra
Wed Apr 11, 2018 5:42 am
Forum: Windows PowerShell
Topic: Using ADSI to get local admins
Replies: 1
Views: 244

Re: Using ADSI to get local admins

I would suspect network or system issues. That code is used extensively. I have never seen it fail.
by jvierra
Tue Apr 10, 2018 11:19 am
Forum: PowerShell GUIs
Topic: Starting a timer on load
Replies: 2
Views: 195

Re: Starting a timer on load

Start by adding this line first:

$timerUpdate.Enabled = $true