plc - VBA Subroutine doesn't exit for loop -


i’m new programing i’m hoping can me. not sure how formulate right question didn’t find stackoverflow answers.

when step through code , come opcservobj.connect opcserverstrg doesn't connect. no errors, nothing appears happen. cursor jumps left margin , nothing. when resume stepping through routine starts function on again. should continue , exit loop plan test state of connection again.

reference library: opc da automation wrapper 2.02

sub main() connectopc end sub  private function connectopc() boolean  dim opcservobj opcautomation.opcserver             dim opcgroupobj opcautomation.opcgroup              dim opcserverlist variant dim opcserverstrg string  set opcservobj = new opcautomation.opcserver           opcserverlist = opcservobj.getopcservers  if opcservobj.serverstate <> true      = 1 ubound(opcserverlist)          opcserverstrg = opcserverlist(i)           if opcserverstrg = "iconics.iconicsopcuaserver.v5"              opcservobj.connect opcserverstrg              exit           end if      next  end if  end function 

thanks

at line:

if opcserverstrg = "iconics.iconicsopcuaserver.v5" 

if value in variable opcserverstrg not equal "iconics.iconicsopcuaserver.v5" code loop again top of for loop , execute opcserverstrg = opcserverlist(i) again. exit for not seen.

when step through code... possible have breakpoint set on line: opcserverstrg = opcserverlist(i), , clicking run (untill breakpoint) instead of clicking single-step through code?

try setting breakpoint @ line:

if opcserverstrg = "iconics.iconicsopcuaserver.v5" 

then examine value of opcserverstrg when program reaches breakpoint , stops.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -