2016-03-20 18 views
0

Bir DropDownList olarak biçimlendirilmiş bir ComboBox'u HTML seçimiyle aynı işlevsellik vermenin bir yolu var mı?PowerShell: DropDownList öğesini HTML ile aynı işlevsellik seçin

Demek istediğim, "Es" harflerini yazarsanız, açılan liste otomatik olarak "ES *" ile ilk değeri seçer çünkü HTML seçiminde böyle olur mu? Şu anda, ikinci harfi girerek, liste "Esp1" yerine "Ssp1" ye atlıyor

Herhangi bir fikir?

HTML referansı: https://jsfiddle.net/j7h2326c/4/

PowerShell Örnek:

Add-Type -AssemblyName System.Windows.Forms 
    $form = New-Object System.Windows.Forms.Form 
    $combobox1 = New-Object System.Windows.Forms.ComboBox 
    $form.Controls.Add($combobox1) 


    $combobox1.Location = '30,30' 
    $combobox1.DropDownStyle = 'DropDownList' 
    $combobox1.Items.AddRange(@('Term add 1', 'Term add 2', 'Term more 1', 'Esp1', 'Esp2', 'Ssp1')) 

    $form.ShowDialog() 

cevap

0

ComboBox Otomatik tamamlama Mod ayarlayın. Orada nerede eksik sadece iki şey:

$combobox1.AutoCompleteSource = 'ListItems' 
$combobox1.AutoCompleteMode = 'Append' 

yani tam kod şöyle olacaktır:

Add-Type -AssemblyName System.Windows.Forms 
    $form = New-Object System.Windows.Forms.Form 
    $combobox1 = New-Object System.Windows.Forms.ComboBox 
    $form.Controls.Add($combobox1) 


    $combobox1.Location = '30,30' 
    $combobox1.DropDownStyle = 'DropDownList' 
    $combobox1.AutoCompleteSource = 'ListItems' 
    $combobox1.AutoCompleteMode = 'Append' 
    $combobox1.Items.AddRange(@('Term add 1', 'Term add 2', 'Term more 1', 'Esp1', 'Esp2', 'Ssp1')) 

    $form.ShowDialog() 
2

Avshalom doğru yönde işaret beni Append

$combobox1.AutoCompleteMode = 'Append' 
+0

teşekkürler. Bu beni hedefime doğru yönlendiriyor. Tek bir şey daha eksikti (AutoCompleteSource ayarı) Eğer aklınızdan çıkarsanız kendi sorumu yanıtladım. – StUffz

İlgili konular