Wrox Programmer Forums
|
BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6
This is the forum to discuss the Wrox book Beginning Visual Basic 2005 by Thearon Willis, Bryan Newsome; ISBN: 9780764574016
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 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 September 9th, 2006, 06:42 PM
Registered User
 
Join Date: Sep 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Page 154, revisited with Option Strict On


I have my VS2005 set to Option Strict On, and the following line in the routine btnDelete_Click

    Return lstCustomers.Items(lstCustomers.SelectedIndex)

gives me an error that says

    "Option Strict On disallows implicit conversions
    from 'Object' to 'StructureDemo.Customer'."

How would I fix this error?

Thanks,
irish_songbird
 
Old September 9th, 2006, 07:24 PM
Registered User
 
Join Date: Sep 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I tried this:

    Return objCustomers(lstCustomers.SelectedIndex)

and got the same error, so I looked around and found this
and tried it, to cast the array list entry as a customer object:

    Return CType(objCustomers(lstCustomers.SelectedIndex),Cus tomer)

and it worked.





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
Option Strict Conversion Problem Little Shell VB.NET 2002/2003 Basics 1 July 17th, 2006 01:30 PM
Option Strict kevin777 VB.NET 2002/2003 Basics 2 October 10th, 2003 11:38 PM





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