class - Visual Basic .Net Objects and Classes -
i designing high level high atm. know can use databases further explore little know of objects.
i have atm running on windows forms. want form print example account balance stored in person object inside account class.
public class account public shared _personname string public shared _withbank string public shared _accountnumber double public shared _accountbalance double public shared _pin integer public sub new(byval personname string, byval accountnumber double, byval accountbalance double, byval pin integer) _personname = personname _accountnumber = accountnumber _maxwithdrawal = withdrawal() _accountbalance = accountbalance _pin = pin end sub end class in forms able switch between 2 persons based on input pin number. able account.newperson.accountnumber , able retrieve accountnumber of person pin number entered.
i struggling creating objects. may doing wrong , appreciate constructive guidance. unsure put these. in same class or in new class?
public shared person1 account = new account("tom jones", 123456789, 6000, 1234) public shared person2 account = new account("bob marley", 987654321, 500, 5678) public shared newperson account = new account("", 0, 0, 0) in forms have if statement if else statement. if result1 account.newperson = account.person1. if result2 account.newperson = account.person2.
i think right way go entirely on wrong tracks. if solved, swap out if else statement search know how that.
thanks help
save account objects in generic list.
dim accounts list(of account) = new list(of account) accounts.add(new account("tom jones", 123456789, 6000, 1234) ) accounts.add(new account("bob marley", 987654321, 500, 5678) ) dim currentname = accounts(0)._personname you can bind list combo box in form , change view depending on account selected.
Comments
Post a Comment