VB.net - code execution order? -


i've got simple gui , i'm storing system information , displaying results.

the 2 problem areas detectaduc , detectexchange sub's. time appropriate label update when place 1 above order in form_load event.

i'm thinking maybe there's need release? holding value somewhere? please take below.

detectexchange

private sub detectexchange()      dim exchange new servicecontroller("microsoft exchange service host")      try         if exchange.status.equals(servicecontrollerstatus.running) or exchange.status.equals(servicecontrollerstatus.startpending)             label9.text = "detected - running"         end if     catch ex invalidoperationexception         label9.forecolor = color.red         label9.text = "not installed"      end try      if exchange.status.equals(servicecontrollerstatus.stopped) or exchange.status.equals(servicecontrollerstatus.stoppending)         label9.text = "detected - not running"     end if  end sub 

detectaduc

private sub detectaduc()     dim aduc new servicecontroller("active directory domain services")     try         if aduc.status.equals(servicecontrollerstatus.running) or aduc.status.equals(servicecontrollerstatus.startpending)             label10.text = "detected - running"         end if     catch ex invalidoperationexception         label10.forecolor = color.red         label10.text = "not installed"      end try      if aduc.status.equals(servicecontrollerstatus.stopped) or aduc.status.equals(servicecontrollerstatus.stoppending)         label10.text = "detected - not running"     end if  end sub 

calling subs

private sub systemchecks_load(sender object, e eventargs) handles mybase.load     richtextbox1.text = datetime.now.tostring("yyyy/mm/dd hh:mm:ss") & (": installation launched")     label12.text = getexternalip()     gethostname()     hardwareid()     detectos()     detectaduc()     detectexchange()     hardwareid() end sub 

as can see different variable name, service name , label's updates. - 1 label ever update, depending on 1 call first within form_load.

i've tried using me.refresh, - i've tried adding new class creating public shared sub , referencing in form_load.

i renamed exchange exception catch ex2

can explain problem can understand , avoid future problems?

i managed resolved myself, see below.

private sub detectexchange()      dim exchange new servicecontroller("microsoft exchange service host")      try         if exchange.status.equals(servicecontrollerstatus.running) or exchange.status.equals(servicecontrollerstatus.startpending)             label9.text = "detected - running"          else          end if         if exchange.status.equals(servicecontrollerstatus.stopped) or exchange.status.equals(servicecontrollerstatus.stoppending)             label9.text = "detected - not running"         end if      catch ex invalidoperationexception         label9.forecolor = color.red         label9.text = "not installed"      end try  end sub  private sub detectaduc()     dim aduc new servicecontroller("active directory domain services")     try         if aduc.status.equals(servicecontrollerstatus.running) or aduc.status.equals(servicecontrollerstatus.startpending)             label10.text = "detected - running"          else          end if         if aduc.status.equals(servicecontrollerstatus.stopped) or aduc.status.equals(servicecontrollerstatus.stoppending)             label10.text = "detected - not running"         end if      catch ex invalidoperationexception         label10.forecolor = color.red         label10.text = "not installed"      end try end sub 

Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -