Click here to Skip to main content
15,915,019 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralResolution Or Screen Area :confused: Pin
syedhassan42-Feb-03 22:23
syedhassan42-Feb-03 22:23 
GeneralRe: Resolution Or Screen Area :confused: Pin
Jerome Conus3-Feb-03 0:32
Jerome Conus3-Feb-03 0:32 
GeneralRe: Resolution Or Screen Area :confused: Pin
xBlitzerx4-Feb-03 9:26
xBlitzerx4-Feb-03 9:26 
Generaladd a combobox to datagrid Pin
Arshia2-Feb-03 20:17
Arshia2-Feb-03 20:17 
GeneralRe: add a combobox to datagrid Pin
Arshia2-Feb-03 20:18
Arshia2-Feb-03 20:18 
GeneralFunctions - Parameter Passing Pin
xBlitzerx2-Feb-03 12:22
xBlitzerx2-Feb-03 12:22 
GeneralRe: Functions - Parameter Passing Pin
xBlitzerx3-Feb-03 15:40
xBlitzerx3-Feb-03 15:40 
GeneralRe: Functions - Parameter Passing Pin
Ray Cassick4-Feb-03 12:03
Ray Cassick4-Feb-03 12:03 
Sorry for not responding dude, but really now....

There are examples on how to create/call functions in VB everywhere. Just download just about any sample VB code and you will see a sample of how to write and consume a function.

I did not answer this question because I felt that it was asked by someone that clearly needed to do some looking around themselves on the subject. Sorry...

Looking at the responses that you did get and what you found on your own you got the concept.

Just please remember that no one here OWES anyone an answer.

Just as a personal note… I hate function that have byref arguments. They are used alot in the Windows world and I still hate them. IMHO functions take in arguments and return a value. That is the pure way of thinking about it. When you use a function you always think of it as:


returnValue = FunctionName(arg1, arg2, … argn)

And the function looks as follows:

<scope> Function FunctionName(arg1 As Type, arg2 As Type, … argn As Type) As ReturnType

   'define the return value to use
   Dim retVal as ReturnType

   'perform what ever calculations you need to do

   'set the return value
   retVal = answerToCalculation

   Return ReturnType 'if you are using VB.NET
   FunctionName = answerToCalulation 'if you are using VB6

End Function


The number of input args are up to what you need, and it is very clear as to what is being returned and where.

Using ByRef is called output arguments. I don't like them at all. Dead | X| As I see it, if the returned values does not end up on the left side of a function call then it is not a function, it is a Subroutine.




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: Functions - Parameter Passing Pin
mikasa4-Feb-03 8:41
mikasa4-Feb-03 8:41 
GeneralRe: Functions - Parameter Passing Pin
xBlitzerx4-Feb-03 9:24
xBlitzerx4-Feb-03 9:24 
Generalword, save Pin
pnpfriend1-Feb-03 8:43
pnpfriend1-Feb-03 8:43 
GeneralRe: word, save Pin
Torsten Mauz3-Feb-03 6:43
Torsten Mauz3-Feb-03 6:43 
QuestionVB 6 SQL problem ??? Pin
mixahlos31-Jan-03 15:07
mixahlos31-Jan-03 15:07 
AnswerRe: VB 6 SQL problem ??? Pin
Ray Cassick31-Jan-03 18:42
Ray Cassick31-Jan-03 18:42 
GeneralInheritance question… Pin
Ray Cassick31-Jan-03 9:43
Ray Cassick31-Jan-03 9:43 
GeneralRe: Inheritance question… Pin
Richard Deeming3-Feb-03 3:23
mveRichard Deeming3-Feb-03 3:23 
GeneralRe: Inheritance question… Pin
Ray Cassick6-Feb-03 7:21
Ray Cassick6-Feb-03 7:21 
GeneralRe: Inheritance question… Pin
mikasa4-Feb-03 8:50
mikasa4-Feb-03 8:50 
GeneralRe: Inheritance question… Pin
Ray Cassick4-Feb-03 9:37
Ray Cassick4-Feb-03 9:37 
Generalinteger Pin
pnpfriend31-Jan-03 3:57
pnpfriend31-Jan-03 3:57 
GeneralRe: integer Pin
Jason McBurney31-Jan-03 4:41
Jason McBurney31-Jan-03 4:41 
GeneralRe: integer Pin
pnpfriend31-Jan-03 9:29
pnpfriend31-Jan-03 9:29 
GeneralRe: integer Pin
xBlitzerx2-Feb-03 14:36
xBlitzerx2-Feb-03 14:36 
Generalquery on createobject Pin
shanksprasad31-Jan-03 2:03
shanksprasad31-Jan-03 2:03 
GeneralRe: query on createobject Pin
RichardGrimmer5-Feb-03 6:28
RichardGrimmer5-Feb-03 6:28 

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.