Hello everyone!
I'm working on my first tool after purchasing PowerShell Studio today and I'm running into an issue. I have a button that I want to execute if a selection is made from a listbox or if text is entered into a textbox. I tried to use an if, elseif, else but PS won't accept $listbox.selecteditem -eq $true -and $textbox.text -eq $null. I was wondering if anyone else has done something like this? Thanks in advance.
One button for multiple boxes
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: One button for multiple boxes
PS = PowerShell (EDIT: I'm sorry, I just re-read your reply. I wasn't trying to be facetious here. I was assuming you were attempting to say that "PS" itself was too ambiguous.)
I was trying to use an "if" statement where if $listbox.SelectedItem was not $null and $textbox.Text was $null, then my button would execute my function. Then I would add an else for the reverse situation. But, what I am seeing is:
Load-DataGridView : Cannot validate argument on parameter 'Item'. The argument is null. Provide a valid value for the argument, and then try running the command again.
While I am still curious about whether or not this can be done, I have found a different way to accomplish what I want.
I was trying to use an "if" statement where if $listbox.SelectedItem was not $null and $textbox.Text was $null, then my button would execute my function. Then I would add an else for the reverse situation. But, what I am seeing is:
Load-DataGridView : Cannot validate argument on parameter 'Item'. The argument is null. Provide a valid value for the argument, and then try running the command again.
While I am still curious about whether or not this can be done, I have found a different way to accomplish what I want.
Re: One button for multiple boxes
I would just use the value assigned in the text box or drop down list as in when you run your function it would be like my-function $textbox.text
Then your running the function of the value in the textbox. Is this what you are after?
Then your running the function of the value in the textbox. Is this what you are after?
- dan.potter
- Posts: 709
- Last visit: Wed Nov 14, 2018 11:39 am
Re: One button for multiple boxes
Is this what you're after?
- Attachments
-
- lbclick.psf
- (41.82 KiB) Downloaded 120 times