.NET

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

Passing variables.

191 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 (190 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: 240
Registered: ‎04-15-2011
Message 3 of 5 (185 Views)

Re: Passing variables.

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

Thanks again!!

Member
Posts: 5
Registered: ‎12-14-2009
Message 4 of 5 (143 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*
Posts: 1,981
Registered: ‎04-29-2006
Message 5 of 5 (122 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
Welcome to the new Autodesk Community!
If this is your first visit, click here to get started and make the most of the Community. Let us know what you think of the new experience in the Community Feedback Forum.

Need installation help?

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

Ask the Community