473,394 Members | 1,956 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

An unhandled exception of type 'System.StackOverflowException' occurred

geo039
47
I am a beginner and I have a class that keeps giving me the "An unhandled exception of type 'System.StackOverflowException' occurred" error. I have looked online and do not understand how to correct the issue. Any takers?


Expand|Select|Wrap|Line Numbers
  1. Public Class BankCustomer
  2.  
  3.     ' Require proper data, on the creation of a new customer
  4.     Public Sub New(ByVal firstName As String, ByVal lastName As String, ByVal accountNumber As String, ByVal balance As Decimal)
  5.         Me.firstName = firstName
  6.         Me.lastName = lastName
  7.         Me.accountNumber = accountNumber
  8.         Me.balance = balance
  9.     End Sub 'New
  10.  
  11.     ' private fields
  12.     Private m_firstName As String
  13.     Private m_lastName As String
  14.     Private m_balance As Decimal
  15.     Private m_accountNumber As String
  16.  
  17.     ' public properties
  18.  
  19.     Public Property FirstName() As String
  20.         Get
  21.             Return firstName
  22.         End Get
  23.         Set(ByVal Value As String)
  24.             firstName = value
  25.         End Set
  26.     End Property
  27.  
  28.     Public Property LastName() As String
  29.         Get
  30.             Return lastName
  31.         End Get
  32.         Set(ByVal Value As String)
  33.             lastName = value
  34.         End Set
  35.     End Property
  36.  
  37.     Public Property Balance() As Decimal
  38.         Get
  39.             Return balance
  40.         End Get
  41.         Set(ByVal Value As Decimal)
  42.             balance = value
  43.         End Set
  44.     End Property
  45.  
  46.     Public Property AccountNumber() As String
  47.         Get
  48.             Return accountNumber
  49.         End Get
  50.         Set(ByVal Value As String)
  51.             accountNumber = value
  52.         End Set
  53.     End Property
  54.  
  55.     ' methods
  56.     Public Sub Deposit(ByVal amount As Decimal)
  57.         ' Add the amount deposited to the 
  58.         ' customers balance.
  59.         balance += amount
  60.     End Sub 'Deposit
  61.  
  62.  
  63.     Public Function GetAccountSummary(ByVal accountNumber As Integer) As String
  64.         Dim summary As String = "Account Number: " + Me.accountNumber + ControlChars.Lf + "Customer: " + Me.lastName + ", " + Me.firstName + ControlChars.Lf + "Balance: " + Me.balance.ToString()
  65.  
  66.         Return summary
  67.     End Function 'GetAccountSummary
  68.  
  69.  
  70.     Public Sub Widthdrawl(ByVal amount As Decimal)
  71.         If amount <= balance Then
  72.             balance -= amount
  73.         Else
  74.             MessageBox.Show("You have insufficient funds, please try a smaller amount", "Insufficient Funds")
  75.         End If
  76.     End Sub 'Widthdrawl
  77. End Class 'BankCustomer
Feb 21 '07 #1
2 2386
geo039
47
I got this functioning....i had the privates all wrong, thanks for viewing =)
Feb 21 '07 #2
kenobewan
4,871 Expert 4TB
Well done!
Feb 23 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Professor Frink | last post by:
First off, I apologize if this gets long. I'm simply trying to give you all enough information to help me out. I'm writing (almost finished, actually), my first VB.Net application. It's a forms...
0
by: Joe Bloggs | last post by:
I have a C# MRS application that uses the ReportingService's Render method to retrieve a byte array containing a report. The following error message occurs An unhandled exception of type...
4
by: Craig831 | last post by:
First off, I apologize if this gets long. I'm simply trying to give you all enough information to help me out. I'm writing (almost finished, actually), my first VB.Net application. It's a forms...
9
by: Supra | last post by:
i got error problem.......... An unhandled exception of type 'System.NullReferenceException' occurred in system.windows.forms.dll Additional information: Object reference not set to an instance of...
0
by: Nikhil Khade | last post by:
Hello, After around 3 months, I reopened a old VB.NET solutions which used to work (and build) without any errors. Just to test it again, I build it again and it completed, without any errors,...
12
by: daz_oldham | last post by:
Hi everyone As my expedition into OOP takes another shaky step, I now am getting the error: An unhandled exception of type 'System.StackOverflowException' occurred in xxx.dll. In my...
1
by: vighnesh | last post by:
Hi All Can anyone please let me know how to catch an unhandled exception like " An Unhandled exception of type 'system.stackoverflowexception' occured in mscorlib.dll " I am unable to catch...
1
by: bunnyjoshi | last post by:
"An unhandled exception of type 'System.StackOverflowException' occurred in asset.dll" Above error is occuring when i m debugging my code. asset.dll is file which is created by me n i m using it...
1
by: ramya naidu | last post by:
Hi I have classes property and sketch in htis property will be linked to skecth class and foure different classes which r linked to the skecth class and two generic list one is for skecth and...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.