Welcome to Dream.In.Code
Become a VB Expert!

Join 137,267 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,508 people online right now. Registration is fast and FREE... Join Now!




Method not valid without suitable object?

 
Reply to this topicStart new topic

Method not valid without suitable object?, what does this mean?

starrz8600
7 Dec, 2006 - 07:22 PM
Post #1

New D.I.C Head
*

Joined: 7 Dec, 2006
Posts: 1


My Contributions
Hi, I am new to the world of VB and am writing a code in which i call another function and attempt to print a value in the original form. When I run the program, I can imput all of the numbers, and it does call the other program, but it will not print and gives the message "Method not valid without suitable object." I've searched this topic online and tried to find it in my classbook, but I'm not finding anything. So, here is what I have so far, this is a very rough draft as I do not understand much about VB...but I guess that is how life goes.
CODE

Private Sub cmdenternumbers_Click()

Dim i As Integer
Dim number As Single

For i = 1 To 10
    number = InputBox("Enter number")
    Print vbTab & number
Next i

Call Mean(x())
Cls
Print
For i = 1 To 10
Print vbTab & x(i)
Next i
Print

End Sub

AND HERE IS THE other module that is called by the main program

Public Function Mean(x() As Single)

Dim total As Single
Dim average As Single

For i = 1 To 10
   total = total + (x(i))
Next i

Print total

End Function


If you've got any good advice, please post a reply or catch me online. AIM screenname = starrz8600

And thanks so much!
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/4/08 07:35PM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month