Link to home
Start Free TrialLog in
Avatar of rhservan
rhservanFlag for United States of America

asked on

Since I am no VBru will someone correct my syntax below? Part I

public function calvalue( vpi float, vcnet float, vtow float, type string) as string

IF vti <> NULL
then vti
else
IF vcnet <> NULL
then vcnet
else
vpow

end function
Avatar of HooKooDooKu
HooKooDooKu

Care to explain what this function is attempting to accomplish?  Because from the stand point of this being VB code, there are numerous things wrong.

Here's a few things to point out.

Syntax of a VB If statement:
1. Single line If
IF condition THEN statement

2. Multi line If (with Else if and Else being optional)
IF condition THEN
    statment
    statment
ELSEIF condition THEN
    statment
    statment
ELSE
    statment
    statment
END IF


Additionally, for a VB function to return a value, you must set the value of the return value using the name of the function.

public function Max( v1 as float, v2 as float ) as float
    IF v1 > v2 THEN
        Max = v1
    ELSE IF v2 > v1 THEN
        Max = v2
    ELSE
        Max = v1
    END IF
end function
Avatar of rhservan

ASKER

How would you test for NULL value?
I am looking for VB code that will test for NULL as in Coalesce. Is this possible?
What's a VBru?
ASKER CERTIFIED SOLUTION
Avatar of HooKooDooKu
HooKooDooKu

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
What's a VBru
Valid question.

I'm assuming that since this question has been posted under the subject and topics related to Visual Basic, I'm assuming that this is either a question regarding VB6, VB Script, or Visual Basic dot Net.
A VBru is an individual established in VB coding as in a Visual Basic guru.(VBru)
Of which I am not.

I am using the Custom Code feature in SSRS 2008 which utilizes Visual Basic.
Thank you for the clarification. I had not heard the term before, and couldn't decide if any answer was dependent on it. My conclusion is that this is not so, and anyway HooKooDooKu is obviously handling the question in an appropriately expert manner.