public void initListView() { List <DealResult> list = oracle.selectDeal(); if (list == null) { MessageBox.Show("데이터가 존재하지 않습니다."); return; } /* string[] data = { "1", "홍길동", "그랜저", "40000000", "전우치"," 21/3/31"}; * dealList.Items.Add(new ListViewItem(data)); */for (int i = 0; i < 50; i++) { dealList.Items.Add(new ListViewItem( new string[] { (i + 2).ToString(), "홍길동", "010-2929-3939", "조선 한양 홍대감댁", "*****@*****.**" } )); } setRowColor(dealList, Color.White, Color.LightGray); int index = dealList.Items.Count - 1; dealList.Items[index].Focused = true; dealList.EnsureVisible(index); }
public void initListView() { List <DealResult> list = oracle.selectDeal(); /*string[] data = { "1", "홍길동", "그랜져", "40000000", "전우치", "21/3/31" }; * dealList.Items.Add(new ListViewItem(data)); * */ if (list == null) { MessageBox.Show("데이터가 존재 하지 않습니다."); return; } for (int i = 0; i < list.Count; i++) { dealList.Items.Add(new ListViewItem( new string[] { list[i].Count.ToString(), list[i].CustName, list[i].Model, list[i].Price, list[i].SellName, list[i].Date } )); } setRowColor(dealList, Color.White, Color.LightGray); int index = dealList.Items.Count - 1; this.dealList.Items[index].Selected = true; dealList.Items[index].Focused = true; dealList.EnsureVisible(index); }