Maintain local variable value between calls in vb.net -


public function methodone(byval s string) string      dim sb new stringbuilder()      sb.append(s)     sb.append(methodtwo())      return sb.tostring()  end function  public function methodtwo() string      dim integer = 0      index integer = 0 5         = index     next      return i.tostring()  end function 

i want retain value of i, once goes methodone, loses value. tried making static integer = 0, did not work.

sorry misread that. how creating property called count, , update whenever methodtwo called. can use property count in methodtwo instead of i.

public function methodone(byval s string) string      dim sb new stringbuilder()      sb.append(s)     sb.append(methodtwo())      return sb.tostring()  end function  public property count integer 'count 0 when initialized  public function methodtwo() string      'dim integer = 0      index integer = 0 5         count = count + index     next      return count.tostring()  end function 

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -