Wrox Programmer Forums
|
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 9th, 2003, 08:33 AM
Authorized User
 
Join Date: Sep 2003
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default Option Strict

Would someone please explain how to fix this code with "Option Strict" on:

Private Function CalculateCircumference(ByVal radius As Single) As Single
        Return (radius * 2) * System.Math.PI
    End Function

I get a squiggly line under (radius * 2) * System.Math.PI...

Option Strict disallows me from converting from Double to Single? Please explain. I've looked through dynamic help...no examples

I've tried: CType, CSng: (CSng(radius * 2, txtRadius.Text)) * System...etc.

Don't think I have the big picture...Thanks in advance...Kevin

 
Old October 9th, 2003, 10:25 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Private Function CalculateCircumference(ByVal radius As Single) As Single
    Return CType((radius * 2) * System.Math.PI, Single)
End Function


Peter
 
Old October 10th, 2003, 11:38 PM
Authorized User
 
Join Date: Sep 2003
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you! planoie






Similar Threads
Thread Thread Starter Forum Replies Last Post
Option Strict On/passing a Datarow cesarfranciso Pro Visual Basic 2005 0 August 1st, 2007 06:04 PM
Option Strict On disallows late binding. binici ASP.NET 2.0 Basics 2 March 2nd, 2007 07:38 PM
Option Strict on / Late Binding (p.535) irish_songbird BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 0 October 18th, 2006 12:51 PM
Page 154, revisited with Option Strict On irish_songbird BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 1 September 9th, 2006 07:24 PM
Option Strict Conversion Problem Little Shell VB.NET 2002/2003 Basics 1 July 17th, 2006 01:30 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.