Combobox example
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: Combobox example
I'm going to take a stab at answering what I think is my first PS question, so if I'm wrong, blame jvierra he taught me everything
So what you want to do is have a drop down that has info you've populated that I'm guessing you're using the Edit Items menu, When the technician hits a domain say D1 and presses the Go! Button, it gets a list of the users? will this work for you?
$button1_Click={
#TODO: Place custom script here
if ($combobox1.Text -eq "dc1")
{
$DisplayInfo.Text = Get-ADUser -Filter *
}
if ($combobox1.Text -eq "dc2")
{
$DisplayInfo.Text = Get-ADUser -Filter *
}
}
Is there a specific reason you want to use a button? If not, you can do this and get the same results
$combobox1_TextChanged={
#TODO: Place custom script here
if ($combobox1.Text -eq "dc1")
{
$DisplayInfo.Text = Get-ADUser -Filter *
}
}
FYI - $displayinfo.text is the name of my text box and I tried to wrap it using the code buttons but they're not working
Also, I'm with OP - the examples are designed for intermediate users and could provide real world examples such as this. Not, Red, Green, Blue or whatever colors they chose.
So what you want to do is have a drop down that has info you've populated that I'm guessing you're using the Edit Items menu, When the technician hits a domain say D1 and presses the Go! Button, it gets a list of the users? will this work for you?
$button1_Click={
#TODO: Place custom script here
if ($combobox1.Text -eq "dc1")
{
$DisplayInfo.Text = Get-ADUser -Filter *
}
if ($combobox1.Text -eq "dc2")
{
$DisplayInfo.Text = Get-ADUser -Filter *
}
}
Is there a specific reason you want to use a button? If not, you can do this and get the same results
$combobox1_TextChanged={
#TODO: Place custom script here
if ($combobox1.Text -eq "dc1")
{
$DisplayInfo.Text = Get-ADUser -Filter *
}
}
FYI - $displayinfo.text is the name of my text box and I tried to wrap it using the code buttons but they're not working
Also, I'm with OP - the examples are designed for intermediate users and could provide real world examples such as this. Not, Red, Green, Blue or whatever colors they chose.
- Attachments
-
- 10-29-2015 12-07-41 AM.png (8.35 KiB) Viewed 3472 times
Re: Combobox example
Nope butjvierra wrote:Are you aware that your solutions will only ever display users from the current domain no matter which selection you choose?
1) I'm trying to give OP something to provide more feedback. This thread is 3 pages long without anything being added.
2) if I had a multi domain setup, I would have been able to test.
3) I blame you for my lack of knowledge ha ha ha.
Re: Combobox example
Then you did not follow the instructions to read the link I posted on page 1. Read the whole page of information and you both will have all of the answers and you will have discovered something very surprising. You might even call it a treat.localpct wrote: Nope but
1) I'm trying to give OP something to provide more feedback. This thread is 3 pages long without anything being added.
2) if I had a multi domain setup, I would have been able to test.
3) I blame you for my lack of knowledge ha ha ha.
Re: Combobox example
We must come from different parts cause a treat to me is something that is handed without prying out info, I know exactly what you're doing but.... Regardless, I'm guessing it might be one of these two
($combobox1.SelectedItem.Equals = "dc1")
Or
($combobox1.SelectedIndex.Equals = "dc1")
Also, I'm not really sure if I need the .Equals =
I'm doing all of this off my phone.
($combobox1.SelectedItem.Equals = "dc1")
Or
($combobox1.SelectedIndex.Equals = "dc1")
Also, I'm not really sure if I need the .Equals =
I'm doing all of this off my phone.
Re: Combobox example
Read the article a few times last night and this morning and nothing is jumping out to me.
Re: Combobox example
What article did you read? I hope it was this one: https://technet.microsoft.com/en-us/lib ... 2147217396localpct wrote:Read the article a few times last night and this morning and nothing is jumping out to me.
Remember I said it was not about a combobox.
- dan.potter
- Posts: 709
- Last visit: Wed Nov 14, 2018 11:39 am
Re: Combobox example
get-aduser... -server $combobox1.SelectedItem
might have to use text, I didn't try it.
might have to use text, I didn't try it.