vb.net - Ouput data in a 1 dimensional array of string -


i have 1 dimensional array string has maybe 5 known items in it. want output each many may in array string label on form in format "i have total of item1, item2, item3, item4, item5 in array". here's how array looks like:

dim dirs string() = directory.getfiles(c:\, "*.txt")  each name in dirs     mylabel.text = name >>> need each item here. ouputing last item. next 

path.getfilename can used file name full file path, , string.join can turn array comma separated string. combining both linq select method replace for each loop with:

mylabel.text = "i have total of " &     string.join(", ", dirs.select(function(x) path.getfilename(x))) &     " in array" 

there path.getfilenamewithoutextension if don't want file extension in output.


Comments