Kelly Garcia
asked on
Calling a function
HI All,
What's the best way to call a function,
is it:
or
What's the best way to call a function,
is it:
function CreateVM()
{
}
$VMName = "ENV-WEB"
CreateVM($VMName)
or
function CreateVM($VMName)
{
}
$VMName = "ENV-WEB"
CreateVM env-web
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks Chris, really appreciate it.
my function is linked to a button, i want to call the function only once upon pressing the button once the processing is complete then they can select another button, how do i do this?
thank you in advance,
Kelly
my function is linked to a button, i want to call the function only once upon pressing the button once the processing is complete then they can select another button, how do i do this?
thank you in advance,
Kelly
Put the function call into the event attached to the button (in the same manner as you would have to open a window). You can force progress through the GUI by enabling and disabling elements as you move between steps.
Development guidelines: https://msdn.microsoft.com/en-us/library/ms714657(v=vs.85).aspx
Approved verbs: https://msdn.microsoft.com/en-us/library/ms714428(v=vs.85).aspx
Style guide: https://github.com/PoshCode/PowerShellPracticeAndStyle
The value of these practices and guidelines comes when it becomes clear that other people might end up working on the code you're producing. You can only do so much, but if a script or module ignores established practices it's that much harder to adjust in the future.
For me the rule is simple, I can name things as a please when I'm tapping away for my own purposes, but anything I produce for other people must adhere to a reasonable set of styling rules.
This is a bit of a development rabbit hole, but if you spend a lot of your day writing code you are a developer.