ListControl控件经典用法
1/// <summary>
2 /// 设定
3 /// </summary>
4 /// <param name="lc">控件名</param>
5 /// <param name="sIndex">期望的 Index 值</param>
6 public static void SelectItemIndex(ListControl lc, string sIndex)
7 {
8 for (int i = 0; i < lc.Items.Count; i++)
9 {
10 if (lc.Items[i].Value == sIndex)
11 {
12 lc.SelectedIndex = i;
13 break;
14 }
15 }
16 }
2 /// 设定
3 /// </summary>
4 /// <param name="lc">控件名</param>
5 /// <param name="sIndex">期望的 Index 值</param>
6 public static void SelectItemIndex(ListControl lc, string sIndex)
7 {
8 for (int i = 0; i < lc.Items.Count; i++)
9 {
10 if (lc.Items[i].Value == sIndex)
11 {
12 lc.SelectedIndex = i;
13 break;
14 }
15 }
16 }