vb.net - Checking if string array and listbox have any similarities -
title says all, have been trying figure out how check if listbox , string array have entries equal , have been unsuccessful.
module module1 public detectedmd5 string() = {"944a1e869969dd8a4b64ca5e6ebc209a"} end module public class form1 private sub button1_click(sender object, e eventargs) handles button1.click dim procs() system.diagnostics.process = system.diagnostics.process.getprocesses dim f string each proc process in procs f = getprocessfilename(proc) if f.length > 0 listbox1.items.add(getmd5string(f)) end if next 'here have been trying compare detectedmd5 string array listbox end sub
i did try doing such
try = + 1 listbox1.selectedindex = dim detection string each item string in detectedmd5 detection = instr(listbox1.selecteditem, item) if detection > 0 msgbox("detected") end if next catch = -1 listbox1.items.clear() exit end try loop
but didn't work, , got
exception thrown: 'system.argumentoutofrangeexception' in system.windows.forms.dll
the reason gives invalidcastexception error because need cast listbox.items string.
dim intersection = detectedmd5.intersect(listbox1.items.cast(of string))
Comments
Post a Comment