c# - Refresh a listbox to display new values -


this newb question i'm sorry.

i'm filling out text box values im grabbing on line , passing them listbox so:

        // textbox1.text = test.tostring();         string[] names = result.split('|');         foreach (string name in names)         {              listbox1.items.add(name);         } 

however i'm trying click on folder , have files displayed there shown in listbox1. i've tried:

   using (var testy = new webclient())         {              test = testy.downloadstring("http://server.foo.com/images/getdirectorylist.php?dir=test_folder");             string[] names1 = test.split('|');             foreach (string name in names1)             {                 listbox1.items.clear();                 listbox1.items.add(name);                 listbox1.update();             }          } 

but happens listbox empties , doesn't refreshed. how can achieve want do?

your lines

        foreach (string name in names1)         {             listbox1.items.clear();             listbox1.items.add(name);             listbox1.update();         } 

makes every string removing ever other item in list.

i'm pretty sure that's not want


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -