【全国软件开发交流群】131627487 【全国软件测试交流群】144758063 【全国计算机技术交流】131628626

查找listbox项的内容

            // Set the search string:
            string myString = "Isabella";
            // Search starting from index -1:
            int index = listBox1.FindString(myString, -1);
            if (index != -1)
            {
                // Select the found item:
                listBox1.SetSelected(index, true);
                // Send a success message:
                MessageBox.Show("Found the item \"" + myString +
                    "\" at index: " + index);
            }
            else
                MessageBox.Show("Item not found.");
posted @ 2011-04-16 10:56  编程中国  阅读(578)  评论(0)    收藏  举报