Having a little trouble working this one out, I'm wanting to store up to 50 movies in an array in order and allow them to be deleted/searched by users.
However it's giving me errors saying that the parseAttempt does not exist and 'string' does not contain a definition for 'TryParse'...
Here's everything that I've got so far, if it'll help makes things clearer. - http://pastebin.com/V4aAAPf5
// Movie Title
parseAttempt = false;
while (parseAttempt == false)
{
Console.Write("Enter the movie title >");
vTemp = Console.ReadLine();
Attempt = string.TryParse(vTemp, out movie_title[current_movie]);
// Check data valid
// Check constraints
if (movie_title[current_movie] <= 0)
{
Console.Write("Movie title must be > 0");
parseAttempt = false;
}
}
TryParse
is not a member of System.String
class. Basically TryParse
or Parse
methods are used to parse "string" datavalue into primitive types - int, float etc.
Remove this Attempt = string.TryParse(vTemp, out movie_title[current_movie]);
It looks like movie_title[]
is some sort of array of a numeric type. If it's an array of int
, then
Attempt = int.TryParse(vTemp, out movie_title[current_movie]);
should work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With