| | |
Help Needed With OOP Bank Account..VB.Net
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Oct 2007
Posts: 3
Reputation:
Solved Threads: 0
Hi everyone!
At the moment I am working on an OOP bank account program as an assignment in VB.Net.
FYI:It has a credit account class with properties of AccountName, AccountNumber and Balance. The credit account class has two methods - deposit and withdraw. You can overdraw on the credit account, but not on the savings account. If the user tries to overdraw on the savings account, a user defined event displays an error message.
I think
I've written the Credit Account and Savings Account classes correctly, but what I'm getting stuck with is the user defined event to display the error message, and I'm getting confused when I try to get it all to work off my GUI. Some buttons and functions work while others kinda don't
...and I'm losing so much sleep over it and it's probably something really minor (to you lol) My interface consists of textboxes(AccName, AccNum & Amount to specify the amount you deposit or withdraw) Radio Buttons (Credit & Savings to choose account type. Deposit & Withdraw to choose transaction) Buttons (Clear, Confirm, Exit) Again, any help, tips, pointers, links or anything that would help or point me in the right direction would be greatly appreciated. Thank you
At the moment I am working on an OOP bank account program as an assignment in VB.Net.
FYI:It has a credit account class with properties of AccountName, AccountNumber and Balance. The credit account class has two methods - deposit and withdraw. You can overdraw on the credit account, but not on the savings account. If the user tries to overdraw on the savings account, a user defined event displays an error message.
I think
I've written the Credit Account and Savings Account classes correctly, but what I'm getting stuck with is the user defined event to display the error message, and I'm getting confused when I try to get it all to work off my GUI. Some buttons and functions work while others kinda don't
...and I'm losing so much sleep over it and it's probably something really minor (to you lol) My interface consists of textboxes(AccName, AccNum & Amount to specify the amount you deposit or withdraw) Radio Buttons (Credit & Savings to choose account type. Deposit & Withdraw to choose transaction) Buttons (Clear, Confirm, Exit) Again, any help, tips, pointers, links or anything that would help or point me in the right direction would be greatly appreciated. Thank you •
•
Join Date: Oct 2007
Posts: 3
Reputation:
Solved Threads: 0
Hi everyone!
Yeah sorry about that...maybe posting the code would be a good idea huh?! lol
Sooooo sorry if I post it wrong...
First Class - Credit Account
Second Class - Savings Account
Then like I said above, I have my form with buttons, radio buttons and textboxes...I have some code written for my form, but it's all messed up so I thought I'd better not post it
I'm unsure of where the RaiseEvent code is supposed to go to "Raise the user defined error message when the user tries to overdraw on the savings account"...and any hints on what I should be trying to write on my 'Confirm' button, on my form to get everything to work that would be cool...so far, when you click on it, it just deposits money into the credit account and shows the running balance. I'm working on the data validation part but again, some parts don't go while some parts do???!!!! AAAAAAAAAARGH....
Thanks for taking the time to give me some much needed advice...
Yeah sorry about that...maybe posting the code would be a good idea huh?! lol
Sooooo sorry if I post it wrong...
First Class - Credit Account
VB.NET Syntax (Toggle Plain Text)
Public Class Credit_Account Private AccountName As String 'Customer's Account Name Private AccountNumber As Integer 'Customer's Account Number Protected Balance As Double 'Customer's Account Balance Public Sub New(ByVal Nm As String, ByVal Bal As Double) AccountName = Nm Balance = Bal End Sub Property AccName() As String Get Return AccountName End Get Set(ByVal Value As String) AccountName = Value End Set End Property Property AccNumber() As Integer Get Return AccountNumber End Get Set(ByVal Value As Integer) AccountNumber = Value End Set End Property ReadOnly Property AccountBal() As Double Get Return Balance End Get End Property Public Overridable Sub Deposit(ByVal Amount As Double) Balance += Amount End Sub Public Overridable Sub Withdraw(ByVal Amount As Double) Balance -= Amount End Sub Public Overridable Sub Display() Console.WriteLine("Name=" & AccountName & ", " & "Balance=" & Balance) End Sub Public Sub ChangeName(ByVal newName As String) AccountName = newName End Sub ' Initial balance is zero for each new instance Public Sub New() Balance = 0 End Sub End Class
Second Class - Savings Account
VB.NET Syntax (Toggle Plain Text)
Public Class Saving_Account Inherits Credit_Account Public Sub New(ByVal Nm As String, _ ByVal Bal As Double) MyBase.New(Nm, Bal) End Sub Public Overrides Sub Withdraw(ByVal Amount As Double) If Amount <= Balance Then ' Use balance, inherited from base class MyBase.Withdraw(Amount) ' Call Withdraw, inherited from base class End If End Sub Public Overrides Sub Display() MyBase.Display() ' Call Display, inherited from base class Console.WriteLine("There are insufficient funds to complete this transaction." & vbCrLf _ & "This account cannot have a negative balance.", "Transaction Error") End Sub End Class
Then like I said above, I have my form with buttons, radio buttons and textboxes...I have some code written for my form, but it's all messed up so I thought I'd better not post it
I'm unsure of where the RaiseEvent code is supposed to go to "Raise the user defined error message when the user tries to overdraw on the savings account"...and any hints on what I should be trying to write on my 'Confirm' button, on my form to get everything to work that would be cool...so far, when you click on it, it just deposits money into the credit account and shows the running balance. I'm working on the data validation part but again, some parts don't go while some parts do???!!!! AAAAAAAAAARGH....
Thanks for taking the time to give me some much needed advice...
![]() |
Similar Threads
- Betting Site For Sale: Offshore Corporations, Bank Accounts, Sports Feeds Included (Websites for Sale)
- Bank Account ===>Need help >.< Thk (C++)
- Unable to view yahoo mail or online bank account etc (Viruses, Spyware and other Nasties)
- bank account (C++)
- Bank account class (C++)
Other Threads in the VB.NET Forum
- Previous Thread: looping thru database results
- Next Thread: Database Encryption
Views: 2790 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
.net .net2008 2005 2008 access account application arithmetic array arrays basic bing button buttons c# center check checkbox code convert crystalreport data database datagrid datagridview date dissertation dissertations dropdownlist excel fade file-dialog filter ftp generatetags google gridview hardcopy images inline input insert intel internet listview mobile monitor net networking objects output panel passingparameters picturebox picturebox1 port position print printing problem project read remove save searchbox searchvb.net select serial shutdown soap sorting survey syntax table tcp temperature text textbox timer timespan toolbox trim update user validation vb vb.net vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio2008 web webbrowser winforms wpf year






