static void Main() { // create a new list box and initialize ListBoxTest lbt = new ListBoxTest("Hello", "World"); // add a few strings lbt.Add("Who"); lbt.Add("Is"); lbt.Add("John"); lbt.Add("Galt"); // 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]); } // end for } // end main
static void Main() { ListBoxTest lbt = new ListBoxTest("Hello", "World"); lbt.Add("Who"); lbt.Add("Is"); lbt.Add("John"); lbt.Add("Galt"); string subst = "Universe"; lbt[1] = subst; lbt["Hel"] = "GoodBye"; for (int i = 0; i < lbt.GetNumEntries(); i++) { Console.WriteLine("lbt[{0}]: {1}", i, lbt[i]); } }
static void Main() { //pravi novi popis i inicijalizira ga ListBoxTest lbt = new ListBoxTest("Hello", "World"); //dodaje nekoliko nizova lbt.Add("Who"); lbt.Add("Is"); lbt.Add("John"); lbt.Add("Galt"); //testira pristup string subst = "Universe"; lbt[1] = subst; lbt["Hel"] = "GoodBay"; //lbt["xyz"]= "oops"; //pristupa svim nizovima for (int i = 0; i < lbt.GetNumEntries(); i++) { Console.WriteLine("lbt[{0}]: {1}", i, lbt[i]); } }