.NET

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

Passing variables.

220 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 (219 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 (214 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 (172 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,103
Registered: ‎04-29-2006
Message 5 of 5 (151 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
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.