Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 7th, 2012, 08:22 PM
Zemallo Zemallo is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2012
Posts: 1 Zemallo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 32 m 20 sec
Reputation Power: 0
Calling a Function From a class

Ok strictly i have a simple class with a simple function in it separate from the form's class. I am having difficulties getting the code rite for calling the function from the class.
Its for a small little "ATM" program I'm doing for a class that requires me to load some data into a collection call that data into the class then show balance and allow for deposits and withdrawals.



Public Class Customer
Public Pin As String
Public Name As String
Public Balance As Double
Public Sub New(ByVal Pin As Integer, ByVal Name As String, ByVal Balance As Double)
Me.Pin = Pin
Me.Name = Name
Me.Balance = Balance.ToString("c")
End Sub
Public Function Deposit(ByVal Amount As Double)
Balance = Balance + Amount
Return Balance
End Function
Public Function Withdraw(ByVal Amount As Double)
If Amount < Balance Then
Balance = Balance - Amount
Return Balance
Else
Return MessageBox.Show("Amount desired exceeds funds")
End If
End Function
Public Function ShowBalance()
Return MessageBox.Show(Balance & "Is the accounts current balance")
End Function
End Class




There is the code for the class. I just need to figure out how to call a function from Class: Customer to Class: Form1

I can already load the data from the collection into a variable of type customer. So my data is already loaded in and happy. I just need the calling of the functions.

Any and all help is appreciated.
-Zemallo


EDIT.
I figured out what i did wrong 3 minutes after i posted this. Thanks to anyone who looked at it and was about to give their own thoughtful answer though!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > Calling a Function From a class

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap