vb.net - VB Form unable to communicate current variable data to other forms -
i'm creating little game in spare time in visual studio 2013 express. it's network game communicates game updates on same functional level instant message chat tutorial out there. mention because i'm wondering if multi-threading part of problem.
the problem: i'm trying communicate variable info between 2 forms, , i'm using normal means of doing has worked in several other parts of project:
otherformname.variablename = new_definition
in instance, sec form (named advantages) spawned first form (named player), , reads , changes variable info in player form. issue here advantages form able see default values given when player form loaded. example:
public class player public cash integer = 0 private sub() cash = 1 advantages.show() end sub end class
second form code:
public class advantages private sub label1.text = player.cash end sub end class
in example, no matter when form advantages beingness launched, can , forever see "var" 0 even if "var" has changed prior launch of advantages form. it's not variables, element properties trying see label.text (and homecoming value identical on launch).
in advantages form, can accurately pull variable info other forms using same syntax, , have tested code in new blank project , works 1 expect.
i have tried creating new blank form, copying info on create sure wasn't error made while creating it. results same. seems linked player code because it's replicatable multiple test forms.
what feels like, title implies, player form operating in it's own space, , left behind shadow of in it's first load.
i'd paste in code here, of thousands of lines of code, have no thought block paste. possible when player connects server, moves new thread inaccessible other parts of program, launched it? if that's case, need utilize delegates communicate between forms? network communication code copied illustration programme found online, didn't build myself i'm afraid don't understand how it's operating.
any guidance appreciated, easy problem solve.
thanks.
vb.net multithreading forms variables communication
No comments:
Post a Comment