Exemplo n.º 1
0
        static void Main()
        {
            // create a new ListBox and initialize
            ListBoxTest lbt = new ListBoxTest("Hello", "World");

            // add a few strings
            lbt.Add("Proust");
            lbt.Add("Faulkner");
            lbt.Add("Mann");
            lbt.Add("Hugo");

            // test the access
            string subst = "Universe";

            lbt[1]     = subst;
            lbt["Hel"] = "GoodBye";
            // lbt["xyz"] = "oops";

            // access all the strings
            for (int i = 0; i < lbt.GetNumEntries(); i++)
            {
                Console.WriteLine("lbt[{0}]: {1}", i, lbt[i]);
            }
        }
Exemplo n.º 2
0
        static void Main()
        {
            // create a new ListBox and initialize
            ListBoxTest lbt = new ListBoxTest("Hello", "World");

            // add a few strings
            lbt.Add("Proust");
            lbt.Add("Faulkner");
            lbt.Add("Mann");
            lbt.Add("Hugo");

            // test the access
            string subst = "Universe";
            lbt[1] = subst;
            lbt["Hel"] = "GoodBye";
            // lbt["xyz"] = "oops";

            // access all the strings
            for (int i = 0; i < lbt.GetNumEntries(); i++)
            {
                Console.WriteLine("lbt[{0}]: {1}", i, lbt[i]);
            } 
        }