private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { /*** * * */ //获取当前选择的project curProject = int.Parse(this.comboBox1.SelectedItem.ToString().Split('_')[0]); //构造数据 List <ID_NAME> lst = new List <ID_NAME>(); ID_NAME data = new ID_NAME(); List <measuring_classify> tmp = allData.getClassFromProject(curProject); //这里肯定是null 但是为了其他地方做个参考使用 if (null != tmp) { foreach (measuring_classify cls in tmp) { data.id = cls.id; data.name = cls.name; lst.Add(data); } } //更新控件显示 updateCtrlVisable(this.groupClass, true, ref lst); }
private void button1_Click(object sender, EventArgs e) { if (this.projectText.Text == "") { MessageBox.Show("请输入项目名称"); return; } //添加数据 curProject = addProject(projectText.Text); //构造数据 List <ID_NAME> lst = new List <ID_NAME>(); ID_NAME data = new ID_NAME(); List <measuring_classify> tmp = allData.getClassFromProject(curProject); //这里肯定是null 但是为了其他地方做个参考使用 if (null != tmp) { foreach (measuring_classify cls in tmp) { data.id = cls.id; data.name = cls.name; lst.Add(data); } } //更新控件显示 updateCtrlVisable(this.groupClass, true, ref lst); }