vb.net - ThreadStart doesn't accept a parameter -


so guys i'm new @ vb.net , wanted create simple program pings , scans open ports . but, pinging ok scanning ports isn't working keep saying "threadstart not accepting parameter" , dont know how fix .anyways code of port scan part:

private sub button2_click(byval sender system.object, byval e system.eventargs) handles button2.click     integer = start1.value end1.value         ' tt= temp threading         control.checkforillegalcrossthreadcalls = false         dim tt new system.threading.thread(addressof scanport)         tt.isbackground = true         tt.start(i)     next end sub 

?...so make accept parameter?

private sub button2_click(sender object, e eventargs) handles button2.click     integer = start1.value end1.value         ' tt= temp threading         control.checkforillegalcrossthreadcalls = false         dim tt new system.threading.thread(addressof scanport)         tt.isbackground = true         tt.start(i)     next end sub  private sub scanport(byval porttoscan integer)     debug.print("scanning port: " & porttoscan)     system.threading.thread.sleep(1000) end sub 

with option strict on, it'd instead:

private sub button2_click(sender object, e eventargs) handles button2.click     integer = cint(start1.value) cint(end1.value)         ' tt= temp threading         control.checkforillegalcrossthreadcalls = false         dim tt new system.threading.thread(new parameterizedthreadstart(addressof scanport))         tt.isbackground = true         tt.start(i)     next end sub  private sub scanport(byval porttoscan object)     dim port integer = ctype(porttoscan, integer)     debug.print("scanning port: " & port)     system.threading.thread.sleep(1000) end sub 

Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -