Star1654
Star1654

Reputation: 13

Instantiating a class in VB

I'm needing help with a little instatiating problem...

This is the code i'm using for the ATM:

   Dim ID As String
    Dim _PinPad As PinPad
    Dim _CashDespenser As CashDespenser
    Dim _PrintManager As PrintManager
    Dim _CardReader As CardReader
    Public Sub New(ByVal _PinPad As PinPad, ByVal _CashDespenser As CashDespenser, ByVal _PrintManager As PrintManager, ByVal _CardReader As CardReader)
        MyBase.New()
        Me._PinPad = _PinPad
        Me._CardReader = _CardReader
        Me._CashDespenser = _CashDespenser
        Me._PrintManager = _PrintManager
    End Sub
    Public Sub New(ByVal ID As String, ByVal _PinPad As PinPad, ByVal _CashDespenser As CashDespenser, ByVal _PrintManager As PrintManager, ByVal _CardReader As CardReader)
        MyBase.New()
        Me.ID = ID
        Me._PinPad = _PinPad
        Me._CardReader = _CardReader
        Me._CashDespenser = _CashDespenser
        Me._PrintManager = _PrintManager
    End Sub

And Now I'm Trying to get it to instatiate in the Form's load event which looks like this:

Dim ThisATM As New ATM
        Dim ThisKeyCard As New KeyCard("1234", "5678", "Mikki Monster")

        ThisATM.getCashDespenser.Dispensecash()
        ThisATM.getID()
        ThisATM.getPinPad.checkpin()
        ThisATM.getPrintManager.print("Pikachu Rules")

The KeyCard class worked fine but the ATM class will not work at all. It seems to not be able to let me put in the parameters after the "New ATM" bit... What do you suggest? Link For an Image of the parameters

Upvotes: 1

Views: 450

Answers (1)

competent_tech
competent_tech

Reputation: 44971

You need to add

Public Sub New()
   MyBase.New()
End Sub

to your ATM class. Then you need to change your

MyBase.New()

statments in the other constructors to

Me.New()

Upvotes: 2

Related Questions