zoukankan      html  css  js  c++  java
  • C#.NET ListBox.cs

         public void SetListBox(ListBox TargetBox, DataTable dt, int Col)
            {
                TargetBox.Items.Clear();
                foreach (DataRow dr in dt.Rows)
                {
                    TargetBox.Items.Add(dr[Col].ToString());
                }
            }

            public void MoveListBoxAll(ListBox SourceBox, ListBox TargetBox)
            {
                string tmpStr = "";
                for (int i = SourceBox.Items.Count; i > 0; i--)
                {
                    tmpStr = SourceBox.Items[i - 1].ToString();
                    TargetBox.Items.Add(tmpStr);
                    SourceBox.Items.Remove(tmpStr);
                }
            }

            public void MoveListBoxBySelected(ListBox SourceBox, ListBox TargetBox)
            {
                int i = SourceBox.SelectedItems.Count;
                if (i == 0)
                {
                    return;
                }
                string[] tmpStr = new string[i];
                int j = 0;
                foreach (string lbitem in SourceBox.SelectedItems)
                {
                    tmpStr[j] = lbitem;
                    j = j + 1;
                }

                foreach (string lbitem in tmpStr)
                {
                    TargetBox.Items.Add(lbitem);
                    SourceBox.Items.Remove(lbitem);
                }
            }

  • 相关阅读:
    求100内的数和
    汉诺塔(印度传说)
    ORA-06502:PL/SQL:数字或值错误:数值精度太高
    触发器的编写
    mysql改密码
    LeetCode-238 Product of Array Except Self
    LeetCode-236 Lowest Common Ancestor of a Binary Tree
    LeetCode-233 Number of Digit One
    LeetCode-230 Kth Smallest Element in a BST
    LeetCode-229 Majority Element II
  • 原文地址:https://www.cnblogs.com/cuishao1985/p/1343348.html
Copyright © 2011-2022 走看看