combobox的SelectedIndexChanged没反应
private void select_comp_Load(object sender, EventArgs e){
CobGroup.Text = "请选择";
GroupInfo();
}
private void GroupInfo()
{
DirectoryEntry MainGroup = new DirectoryEntry("WinNT:");
CobGroup.Items.Add("请选择");
foreach (DirectoryEntry domain in MainGroup.Children)
{
CobGroup.Items.Add(domain.Name.ToString());
}
}
private void ComputerInfo(string strname)
{
DirectoryEntry MainGroup = new DirectoryEntry("WinNT:");
foreach (DirectoryEntry domain in MainGroup.Children)
{
if (domain.Name == strname)
{
foreach (DirectoryEntry pc in domain.Children)
{
if (pc.Name != "Schema")//Schema是结束标记
CobComputer.Items.Add(pc.Name);
}
}
}
}
private void CobGroup_SelectedIndexChanged(object sender, EventArgs e)
{
ComputerInfo(CobGroup.Text);
}