Jump to content
Xtreme .Net Talk

Search the Community

Showing results for tags 'invalid'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • New Member at Xtreme .Net Talk?
    • Meet and Greet
    • Announcements
  • .NET
    • General
    • Windows Forms
    • ASP.NET
    • Directory / File IO / Registry
    • Database / XML / Reporting
    • Network
    • Graphics and Multimedia
    • Interoperation / Office Integration
    • Deployment
    • Regular Expressions
    • Syntax Specific
  • Knowledge Base
    • Tutors Corner
    • Code Library
    • Quick Tips
  • Xtreme .Net Talk Members Area
    • Water Cooler
    • Suggestions, Bugs, and Comments

Blogs

There are no results to display.

Categories

  • Code Samples
  • Tutorials & Guides
  • Articles
  • Code Downloads

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


About Me


Location


Occupation


Visual Studio .NET Version


.NET Preferred Language


Skype


Facebook


Twitter ( X )

Found 1 result

  1. hi, im trying to make a simple search tool for an array read from a .txt file. The .txt file has two types of items, movies and games and looks like this for example: M0001;DVD;The Hours;Nicole Kidman, Meryl Streep;Stephen Daldry;10 G0004;PlayStation 2;Spy Hunter 2;12 the file is read in a FileReader class which has an if statement specifying whether the item is a movie or a game. The 'Movie' and 'Game' classes are inherited from a class called 'RentalItem'. In the method im writing that does the actual search i have this and it works fine: rentalList = new ArrayList(); rentalList = FileReader.readRentalItems(); public string QueryMovieItem (string title, string actor, string director) foreach (RentalItem m in rentalList) { if (m.Title == title) sb.Append(m.ItemId + ", " + m.Title + ", copies: " + m.Copies + "\n\n"); }[/Code] however the following highlights "Movie" and generates the error "unable to cast object of type 'VideoStore.Game' to 'VideoStore.Movie" : [code]foreach (Movie m in rentalList) { if (m.Director == director) sb.Append(m.ItemId + ", " + m.Title + ", copies: " + m.Copies); } can anyone tell me why this is happening and how i can possibly fix it. thanks in advance :)
×
×
  • Create New...