since projects create contains listviews got idea class contains important functions modify listview. this:
mainform:
listviewfunctions lvf = new listviewfunctions(); listview newlv = new listview(); newlv = lvf.additem(newlv, new list<string> { "item", "subitem1", "subitem2" }); class:
public class listviewfunctions { public listview additem(listview lv, list<string> inputstrings) { if (inputstrings.count > 0) { (int = 0; < inputstrings.count; i++) { if (i == 0) lv.items.add(inputstrings[0]); else lv.items[lv.items.count - 1].subitems.add(inputstrings[i]); } } return lv; } } however i'm not sure if passing controls class above considered dangerous nor how affect performance. i'm hoping can answer if safe or not.
thanks in advance!
i use helper class have done if planning make generic utilise class on other types.
creating custom control extending listview may preferable way implement listview methods.
public class mycustomlistview : listview { //... }
Comments
Post a Comment