private void cbConfig_SelectedIndexChanged(object sender, EventArgs e) { Sp_config cfg = (Sp_config)cbConfig.SelectedItem; if (cfg == null) { return; } Sp_url[] spUrl = new Sp_urlDAL().GetAllData(cfg.Code); double[] arr = new double[50]; List <Sp_url> list = spUrl.ToList();//把数组转换成泛型类 for (int index = 0; index < list.Count; index++) { Sp_url oneUrl = list[index]; if (oneUrl.Code == UrlCode) { list.RemoveAt(index); break; } } //double[] newarr = list.ToArray();//再由泛型类转换成数组 cbUrl.DataSource = list; }
private void ShowDGV() { dgvShowUrl.Rows.Clear(); Sp_url[] spUrl = new Sp_urlDAL().GetAllData(Code); for (int i = 0; i < spUrl.Length; i++) { int d = dgvShowUrl.Rows.Add(); dgvShowUrl.Rows[d].Cells["编号Url"].Value = d; dgvShowUrl.Rows[d].Cells["索引开始"].Value = spUrl[i].StartIndex; dgvShowUrl.Rows[d].Cells["索引结束"].Value = spUrl[i].StopIndex; dgvShowUrl.Rows[d].Cells["步长"].Value = spUrl[i].Step; dgvShowUrl.Rows[d].Cells["基础URL"].Value = spUrl[i].BaseUrl; dgvShowUrl.Rows[d].Cells["动态变化URL"].Value = spUrl[i].ShortUrl; dgvShowUrl.Rows[d].Cells["循环模式"].Value = spUrl[i].LoopType; dgvShowUrl.Rows[d].Cells["网站名"].Value = spUrl[i].Name; dgvShowUrl.Rows[d].Cells["网站别名"].Value = spUrl[i].Alias; dgvShowUrl.Rows[d].Cells["Sheet名称"].Value = spUrl[i].Sheet; dgvShowUrl.Rows[d].Cells["归属配置Code"].Value = spUrl[i].ConfigId; dgvShowUrl.Rows[d].Cells["记录的唯一索引"].Value = spUrl[i].Code; dgvShowUrl.Rows[d].Cells["分类"].Value = spUrl[i].Classfic; if (spUrl[i].LoopType == 1) { dgvShowUrl.Rows[d].Cells["循环模式"].Value = "静态模式"; } else { dgvShowUrl.Rows[d].Cells["循环模式"].Value = "循环模式"; } if (spUrl[i].Enable == 1) { dgvShowUrl.Rows[d].Cells["是否生效"].Value = "是"; } else { dgvShowUrl.Rows[d].Cells["是否生效"].Value = "否"; } dgvShowUrl.Rows[d].Cells["Id"].Value = spUrl[i].Id; } if (dgvShowUrl.Rows.Count > 0) { foreach (DataGridViewRow dgvr in dgvShowUrl.Rows) { dgvr.Selected = false; } dgvShowUrl.Rows[0].Selected = true; } }