.NET

Reply
Mentor
SRSDS
Posts: 247
Registered: ‎04-15-2011
Message 1 of 5 (219 Views)
Accepted Solution

Passing variables.

219 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

 

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

*Expert Elite*
arcticad
Posts: 1,285
Registered: ‎06-21-2004
Message 2 of 5 (218 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))
Mentor
SRSDS
Posts: 247
Registered: ‎04-15-2011
Message 3 of 5 (213 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 (171 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,084
Registered: ‎04-29-2006
Message 5 of 5 (150 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
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 or visit the Installation and Licensing Forum to get help installing your software.