如何使用数组获取所有组合框项.. [英] how to get the all combobox item .... using array

查看:115
本文介绍了如何使用数组获取所有组合框项..的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在单个数组中获取所有组合框项目....

how to get all combobox items in single array........

推荐答案

数组到项目
Array to items
Dim items() as String = new String(){"Typical", "Compact", "Custom"}
ComboBox1.Items.AddRange(installs)



字符串数组中的项目列表



List of items in string array

Dim items() As String = (From item As String In ComboBox1.Items Select item).ToArray


您可以运行循环并遍历下拉菜单中的项目.
You can run a loop and iterate over the items in the drop down.
foreach(ListItem l in ddown.Items)
{
    myArr.Add(l);
}



或者您可以使用LINQ



Or you could use LINQ

myarr = down.Items.OfType<listitem>().ToArray();</listitem>


这篇关于如何使用数组获取所有组合框项..的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆