void ValidateControlText(Control c)
{
if (c is ComboBox)
{
foreach (string item in b.Items)
{
MessageBox.Show(b.Item.ToString());
}
}
} 请问各位,想要实现这样遍历ComboBox各个项的功能函数,这个foreach 遍历该如何写?
{
if (c is ComboBox)
{
foreach (string item in b.Items)
{
MessageBox.Show(b.Item.ToString());
}
}
} 请问各位,想要实现这样遍历ComboBox各个项的功能函数,这个foreach 遍历该如何写?
{
MessageBox.Show(obj.ToString());
}
{
response.write(li.text)
}
{
MessageBox.Show(Item.ToString());
}
foreach (ListItem item in c.Items)
{
MessageBox.Show(Item.ToString());
}
{
MessageBox.Show(item.对应的操作 );
}
{
\\
}
void ValidateControlText(Control c)
{
if (C.GetType() == typeof(ComboBox))
{
foreach (string item in c.Items)
{
MessageBox.Show(item.Value);
}
}
}
public List<string> GetComboBoxItems(Control c)
{
List<string> itemList = new List<string>();
if (c is ComboBox)
{
foreach (string s in (c as ComboBox).Items)
{
itemList.Add(s);
}
}
return itemList;
}
跟
foreach (string item in c.Items)
一样,c没有Items这个属性?
void ValidateControlText(Control c)
{
ComboBox b = c as ComboBox;
if (b != null)
foreach (string item in b.Items)
{
MessageBox.Show(item);
}
}
void ValidateControlText(Control c)
{
if (c is ComboBox)
foreach (string item in ((ComboBox)c).Items)
{
MessageBox.Show(item);
}
}