Ben_T
❔ Accessing variable from another class
So what would be the proper solution? I don’t need to modify the balance, I just need the value so changing the values isn’t really an issue but I want to know what the proper way to do it would be in my scenario
21 replies
❔ Accessing variable from another class
(This is a windows forms app, sorry I did not mention sooner)
Okay so within my Customer class I created this
And then in my login class I called the CustomerForm.Select() and then in my MoneyOrder class I have this
this uses a static variable to save the information set in the instance and i save it when logging in and then can use the information that way. Is there anything you see wrong with my code here that could cause problems?
I was thinking if I log out (not created 'yet') then when I log back in will there be an issue as the static variable is already set?
21 replies
❔ Accessing variable from another class
well I only need one balance at a timeand its saved in a sql database and pulled from the database when the user logs in (which includes an ID but that ID number is not accessible to give the customer anonymity in the future) but all the information about the customer is saved in the Customer class. But if I were to make a list in the Customer class and add the balance and ID to it, wouldnt I run into the same problem of accessing a new instance of the class, just this time I'm accessing an empty list?
21 replies