.NET

Reply
Distinguished Contributor
SRSDS
Posts: 243
Registered: ‎04-15-2011
Message 1 of 5 (213 Views)
Accepted Solution

Passing variables.

213 Views, 4 Replies
03-15-2012 02:05 PM

Can someone suggest what is wrong here?

Diameter is passed in as 12.7 but it is not acceptint it as a true statement.

 

    Function Volume(Diameter As Single)
        If Diameter = 12.7 Then
        end if
    End Function

 

*Expert Elite*
arcticad
Posts: 1,285
Registered: ‎06-21-2004
Message 2 of 5 (212 Views)

Re: Passing variables.

03-15-2012 02:25 PM in reply to: SRSDS

    Function Volume(ByVal Diameter As Single) As Boolean
        If Diameter = CSng(12.7) Then
            Return True
        Else
            Return False
        End If
    End Function

---------------------------



(defun botsbuildbots() (botsbuildbots))
Distinguished Contributor
SRSDS
Posts: 243
Registered: ‎04-15-2011
Message 3 of 5 (207 Views)

Re: Passing variables.

03-15-2012 02:44 PM in reply to: arcticad

Thanks again!!

Member
sbarlage
Posts: 5
Registered: ‎12-14-2009
Message 4 of 5 (165 Views)

Re: Passing variables.

04-10-2012 03:32 AM in reply to: SRSDS

I think this will do it too:

 

If Diameter = 12.7# Then end if

*Expert Elite*
_gile
Posts: 2,077
Registered: ‎04-29-2006
Message 5 of 5 (144 Views)

Re: Passing variables.

04-10-2012 09:33 AM in reply to: sbarlage

Hi,

 

Don't make VB more verbose than it is...

 

    Function Volume(ByVal Diameter As Single) As Boolean
        Return Diameter = 12.7F
    End Function

 But why using a Single rather than a Double ?

Gilles Chanteau

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community