Results 1 to 6 of 6

Thread: I follow tutorials word for word but I still get build errors...

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2002
    Location
    UK
    Posts
    130

    I follow tutorials word for word but I still get build errors...

    I keep doing tutorials and typing stuff out word for word but I always get build errors and I keep having to leave it and go onto the next because I can't fix it myself. I've just followed a video tutorial and watched the guy write it all out, so I copied it, and I got errors.

    Errors are as follows:

    Error 1 The best overloaded method match for 'int.Parse(string)' has some invalid arguments C:\Websites\Begin\Chapter10\SimpleUserControl\Global.asax 39 25 C:\...\SimpleUserControl\

    Error 2 Argument '1': cannot convert from 'method group' to 'string' C:\Websites\Begin\Chapter10\SimpleUserControl\Global.asax 39 35 C:\...\SimpleUserControl\



    The errors referred to this piece of code:

    void Session_End(object sender, EventArgs e)
    {
    int userCount = int.Parse(Application.Get("userCount").ToString);
    userCount--;
    Application.Set("userCount", userCount);
    }


    The best bit is I have the exact same code in the Session_Start and there are no errors, but I can't see any difference. What is wrong with that?


    Thanks in advance
    PJ

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Jan 2002
    Location
    UK
    Posts
    130

    Re: I follow tutorials word for word but I still get build errors...

    What a pile of poo. I just cut it and pasted it back in and now it works - why would it do that? As if it's not hard enough to learn without errors they go and put some in that aren't even proper ones.
    PJ

  3. #3
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: I follow tutorials word for word but I still get build errors...

    Code:
    int userCount = int.Parse(Application.Get("userCount").ToString);
    You're missing the argument parentheses after ToString. Without them, it is a reference to the ToString method. With them, you are calling the ToString method.

    Microsoft don't put errors in deliberately, they have enough as it is.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Jan 2002
    Location
    UK
    Posts
    130

    Re: I follow tutorials word for word but I still get build errors...

    What's annoying is I put them in after I compared it to the line in the Session_Start which was working, but the errors remained when I tried to run. Then cutting and pasting it back worked.

    Thanks for your help and quick response.
    PJ

  5. #5
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: I follow tutorials word for word but I still get build errors...

    Sometimes you have to manually build it before running, by pressing F6 (then F5).

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Jan 2002
    Location
    UK
    Posts
    130

    Re: I follow tutorials word for word but I still get build errors...

    Ah ok, thanks, I didn't know about that one
    PJ

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width