Click here to Skip to main content
15,923,376 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralLaunching executable file Pin
Desmond23-Dec-02 7:42
Desmond23-Dec-02 7:42 
GeneralRe: Launching executable file Pin
Ray Cassick23-Dec-02 9:29
Ray Cassick23-Dec-02 9:29 
QuestionHow to pass a ADO object as a parameter to a function? Pin
Anonymous22-Dec-02 17:25
Anonymous22-Dec-02 17:25 
AnswerRe: How to pass a ADO object as a parameter to a function? Pin
Nick Seng22-Dec-02 17:57
Nick Seng22-Dec-02 17:57 
GeneralRe: How to pass a ADO object as a parameter to a function? Pin
Anonymous22-Dec-02 18:40
Anonymous22-Dec-02 18:40 
GeneralRe: How to pass a ADO object as a parameter to a function? Pin
Nick Seng22-Dec-02 20:01
Nick Seng22-Dec-02 20:01 
GeneralRe: How to pass a ADO object as a parameter to a function? Pin
Anonymous22-Dec-02 20:41
Anonymous22-Dec-02 20:41 
GeneralRe: How to pass a ADO object as a parameter to a function? Pin
Ray Cassick23-Dec-02 7:02
Ray Cassick23-Dec-02 7:02 
But do you understand WHY this worked? I think that is more important.

Using parens in VB mandates that your function RETURN something.

For example:

Public Function AddNumbers(numOne As Integer, numTwo As Integer) As Ineteger

   Dim retVal as Integer

   retVal = numOne + numTwo

   AddNumbers = retVal

End Function

This function would be called like so:

Dim answer As Integer

answer = AddNumbers(1, 2)

If you have a Subroutine they generally don't return anything. This is afterall the main difference between a Function and a Subroutine. Functions do soemthing AND return something.

Given a Subroutine as such:

Public Sub DisplaySomething(something As String)
   Debug.Print something
End Sub

Because this does not return anything it has to be called one of the following ways:

DisplaySomething "Hello World."

-or-

Call DisplaySomething("Hello World.")


This is one of the reasons that alot of people don't like VB. They feel confused by needing to rememebr if they have to use parens or not.

Generally speaking i think that using the Call keyword is bad form though. Simply don't use parens and all is fine.




Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."

George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."

GeneralRe: How to pass a ADO object as a parameter to a function? Pin
Nick Seng25-Dec-02 14:48
Nick Seng25-Dec-02 14:48 
GeneralRe: How to pass a ADO object as a parameter to a function? Pin
Jason McBurney10-Jan-03 13:30
Jason McBurney10-Jan-03 13:30 
GeneralVB and pointer to function Pin
Asad raza20-Dec-02 21:37
Asad raza20-Dec-02 21:37 
GeneralRe: VB and pointer to function Pin
Ray Cassick23-Dec-02 7:07
Ray Cassick23-Dec-02 7:07 
GeneralCapture output Pin
Teir20-Dec-02 19:15
Teir20-Dec-02 19:15 
GeneralRe: Capture output Pin
Ray Cassick23-Dec-02 7:08
Ray Cassick23-Dec-02 7:08 
GeneralRe: Capture output Pin
Tatham26-Dec-02 6:22
Tatham26-Dec-02 6:22 
GeneralRe: Capture output Pin
Ray Cassick26-Dec-02 6:27
Ray Cassick26-Dec-02 6:27 
GeneralRe: Capture output Pin
Tatham26-Dec-02 6:34
Tatham26-Dec-02 6:34 
GeneralDirectX 9.0 Released Pin
Heath Stewart20-Dec-02 9:27
protectorHeath Stewart20-Dec-02 9:27 
GeneralActiveX DLL control help Pin
Todd Smith20-Dec-02 8:56
Todd Smith20-Dec-02 8:56 
GeneralRe: ActiveX DLL control help Pin
Ray Cassick23-Dec-02 7:10
Ray Cassick23-Dec-02 7:10 
GeneralVB6 app de-compiler Pin
Andy H19-Dec-02 23:00
Andy H19-Dec-02 23:00 
GeneralRe: VB6 app de-compiler Pin
Ray Cassick23-Dec-02 7:11
Ray Cassick23-Dec-02 7:11 
Generalsecondary thread to add data to the control Pin
kasturirawat19-Dec-02 14:26
kasturirawat19-Dec-02 14:26 
Questioninput validation?? Pin
drmzunlimited19-Dec-02 4:04
drmzunlimited19-Dec-02 4:04 
AnswerRe: input validation?? Pin
Nick Seng19-Dec-02 14:50
Nick Seng19-Dec-02 14:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.