vb.net - Improving the arrangement and layout of my listbox -
i'm having trouble visual basic. i'm trying make listbox this:
however ends this:
is there way can organise data? also, how can make total number of universities fixed @ bottom , "university name" "abbreviation"at top? how add vertical scroll bar? also, how can calculate total number of students @ bottom?
this code:
private sub piclist_click(byval sender system.object, byval e system.eventargs) handles piclist.click frmlist.show() frmlist.lstshow.items.clear() dim fmtstr string = "{0,-0}{1,-20}{2,-15}{3,-20}{4,-25}" dim integer frmlist.lstshow.items .add(string.format(fmtstr, "university name", "abbreviation", "state", "accredited year", "total students")) = 0 n - 1 .add(string.format(fmtstr, names(a), abbreviation(a), state(a), accredited(a), total(a))) next .add(string.format(fmtstr, "", "", "", "", "")) .add("total of " & n & " universities.") end end sub
to honest: wouldn't use listbox issue. easier use datagridview , labels display totals. if use dgv write function sums values in column "total students" , displays value in specific label.
anyway, add vertical scrollbar need give listbox fixed size (autosize= false) , autoscroll=true in gui editor.