Event Raised

mshahid

Active member
Joined
Aug 23, 2012
Messages
29
Programming Experience
Beginner
Hi i am new in vb. i am trying to declare classe in which i used event. but i got the errors just like Error 1 Name 'mintCapacity' is not declared. or Error 5 Name 'mstrName' is not declared. below is the code. Kindly help me.Thanks in advance.

Public Class Buket
Private ContentsValue As Integer
Private CapacityValue As Integer
Private NameValue As String

Public Event Full()
Public Event Overflowing(ByVal Sender As System.Object)
Public Sub New(ByVal Capacity As Integer)
mintCapacity = Capacity
mintContents = 0
End Sub
Public Sub Empty()
mintContents = 0
End Sub

Public ReadOnly Property Contents()
Get
Contents = mintContents
End Get
End Property
Public Property Name() As String
Get
Name = mstrName
End Get
Set(ByVal value As String)
mstrName = value
End Set
End Property

Public Sub Add(ByVal Amouunt As Integer)
mintcontents = mintcounts + Amount
If mintcontents > mintcapacity Then
RaiseEvent Overflowing(Me)
mintcontents = mintcapaicty
ElseIf mintcontents = mintcapacity Then
RaiseEvent Full()
End If
End Sub
End
Class
 
This looks like a case of copying and pasting without understanding. You have declared fields named ContentsValue, CapacityValue and NameValue but then you try to use fields named mintcontents, mintcapacity and mstrName.
 
yes you r right i have tiried this program but As i said that i am new in vb. Kindly let me know should we declare method in class.
 
Back
Top