Folder name to combobox in VB.NET -
i wanted combo box fill in runtime checking directory name in directory.
here code :
private sub editform_load(sender object, e eventargs) handles mybase.load call clear() end sub private sub clear() qtytb.enabled = false parttb.clear() qtytb.clear() dtcb.items.clear() mthcb.selectedindex = "" yrcb.selectedindex = "" radiobutton2.checked = true radiobutton1.checked = true textbox1.clear() textbox2.clear() >> dim di new directoryinfo("d:\database\" & pick_item.deptlbl.text) if di.exists = true each subdirectory directoryinfo in di.getdirectories() yrcb.items.add(cint(subdirectory.name.tostring)) next end if<< end sub
that complete code combobox , load form when debug, appear messagebox error dont know error in code
"conversion "" string integer not valid"
thing this. so, how can add folder name combobox? directories name using integer (cause name year), if add directories name(not integer) can. appreciated
your problem in top line
dim folders() string = io.directory.getdirectories("d:\database\") each folder string in folders combobox1.items.add(folder) next
update
is there other code present in subroutine/event not included above? tried , works fine if folder names numbers
i think problem in these lines
mthcb.selectedindex = "" yrcb.selectedindex = ""
change them
mthcb.selectedindex = -1 yrcb.selectedindex = -1
Comments
Post a Comment