Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 3rd, 2005, 04:27 AM
Registered User
Join Date: Jan 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error, Strict On disallows implicit conversions f

I have recently bought the Wrox VB.NET 2003 book ISBN 0764556584, which is great! I have entered some code from Chapter 4, page 105, Using Select Case Project.

 Private Sub lstData_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstData.SelectedIndexChanged
        ' what did you choose?
        Dim name As String
        [red]name = lstData.Items(lstData.SelectedIndex)[red]

        ' use a select case to do something...
        Dim favoriteColor As String

        Select Case name.ToLower

            Case "darren", "edward"
                MessageBox.Show("Male", "Select Demo")

            Case "stephanie", "cathy", "zoe"
                MessageBox.Show("Female", "Select Demo")

            Case Else
                MessageBox.Show("I don't know the ************ of this person.", _
                                "Select Demo")

        End Select
    End Sub

When I run the project I get the following ERROR > [red]C:\Documents and Settings\Gary & Jackie\My Documents\Gary\Programming\Vbnet\Select Case\Select Case\Form1.vb(64): Option Strict On disallows implicit conversions from 'System.Object' to 'String'.[red] The error relates to the line name = lstData.Items(lstData.SelectedIndex)above.

Now here's my problem.....when I download the exact same code from the website it works! (I have Strict on for that code too)!

Any ideas...it's driving me mad! :(

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQL conversions - chapter 7 gorillapoop BOOK: Professional PHP 5 ISBN: 978-0-7645-7282-1 2 February 15th, 2011 11:02 AM
implicit conversion seymour_glass C# 7 November 4th, 2007 05:42 PM
Option Strict On disallows late binding. binici ASP.NET 2.0 Basics 2 March 2nd, 2007 07:38 PM
Type Conversions nikotromus Access VBA 2 October 7th, 2004 05:30 PM
Time conversions from 24hr to am/pm Blaise Classic ASP Basics 2 July 14th, 2003 09:38 PM

All times are GMT -4. The time now is 05:15 AM.

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