vb.net - Retrieve AD results to Listbox VisualStudio -


i trying results active directory listbox created.

normally code in excel vba in case needed move project visual studio can later compile exe.

so here excel vba code working perfectly:

private sub commandbutton1_click()  set objconnection = createobject("adodb.connection") objconnection.open "provider=adsdsoobject;"  set objcommand = createobject("adodb.command") objcommand.activeconnection = objconnection  objcommand.commandtext = _  "<ldap://ou=abc-computers,dc=abc,dc=local>;(objectcategory=computer);name;subtree" set objrecordset = objcommand.execute  rcarray = objrecordset.getrows  userform1.listbox1     .columncount = 1     .clear     .list = application.transpose(rcarray)     .listindex = -1 end  objconnection.close  end sub 

i have started new visual studio project (visual basic -> windows form application) , created "form1". when tried incorporate above code didn't work.

below screen:

error http://im54.gulfup.com/yx9eme.png

after trying hours adapt it, couldn't anywhere close :(

any highly appreciated. thanks,

as error message says, first need declare variable before can use it. else wouldn't know scope example.

in order declare variable in vb.net, need use dim keyword:

dim objconnection = createobject("adodb.connection") 

some required reading on declaring variables


Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -