.NET

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

Passing variables.

222 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 (221 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: 250
Registered: ‎04-15-2011
Message 3 of 5 (216 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 (174 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,114
Registered: ‎04-29-2006
Message 5 of 5 (153 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
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!