Click here to Skip to main content
15,903,012 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i want to make a menu where i can unlock buttons after gaining a certain xp , but i am unable to regain access to the value of xp from another form , so what should i do ?

What I have tried:

i have tried : public int xp{get;set;};
but in the other form when i type : totalxp=form2.xp i get an error
Posted
Updated 24-Dec-16 10:22am
v2

1 solution

Add a property to the form with the variable you wish to access;

public int n { get; set; } // n is a very bad name for a variable.

Then access the variable with

theformsname.n = thevaluetosetitto;
 
Share this answer
 
v2
Comments
Member 12917818 24-Dec-16 16:06pm    
Thank you for your answer but when i get an error when i try to //theformsname.n = thevaluetosetitto;
Member 12917818 24-Dec-16 16:07pm    
thank you for your answer but i get an error when //theformsname.n = thevaluetosetitto;

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900