How to access variables of a referenced class library in a Winforms application
I have a Windows Forms application with a reference for the class library in my Win-forms project.
- The win-form has a combo-box and a button.
- the class library has a global variable value1,value2 and other code which depending on value1 executes some code.
In win-form i make a selection in the combo-box and on button click depending on the selection made i should assign a value to the variable "value1" of class library as value = true . i created an instance of the class library as classlibraryname clb = new classlibrary() but after that i am no开发者_如何学编程t able to assign true to the class library variable "value1" .
how can i assign a value to variable value1???
I am new to working with c# and class libraries .please help
Declare your variable in the class library as public
public bool variable1;
Then in your winform do the following:
classlibraryname clb = new classlibraryname();
clb.variable1 = true;
精彩评论