CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    May 2011
    Posts
    2

    Problem with coding from a beginner

    I am having problems with my code. At first it was going fine until I went ahead and added more bitmaps and finished my code. First, it displayed the error message and also the last bitmap. I then tried else but it claims that I am missing an if but they are there. What did I do wrong?
    Attached Files Attached Files

  2. #2
    Join Date
    Aug 2000
    Location
    New York, NY, USA
    Posts
    5,656

    Re: Problem with coding from a beginner

    Quote Originally Posted by deathmankid View Post
    I am having problems with my code. At first it was going fine until I went ahead and added more bitmaps and finished my code. First, it displayed the error message and also the last bitmap. I then tried else but it claims that I am missing an if but they are there. What did I do wrong?
    You have ";" after "if" statements. Remove them.
    Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
    Convenience and productivity tools for Microsoft Visual Studio:
    FeinWindows - replacement windows manager for Visual Studio, and more...

  3. #3
    Join Date
    May 2011
    Posts
    2

    Re: Problem with coding from a beginner

    Quote Originally Posted by VladimirF View Post
    You have ";" after "if" statements. Remove them.
    I removed them, but else is still "illegal."

  4. #4
    Join Date
    Aug 2000
    Location
    New York, NY, USA
    Posts
    5,656

    Re: Problem with coding from a beginner

    Quote Originally Posted by deathmankid View Post
    I removed them, but else is still "illegal."
    You must have missed one or two. Without your code I can only guess...
    Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
    Convenience and productivity tools for Microsoft Visual Studio:
    FeinWindows - replacement windows manager for Visual Studio, and more...

  5. #5
    Join Date
    May 2006
    Location
    Dresden, Germany
    Posts
    458

    Re: Problem with coding from a beginner

    Furthermore you confused operator "==" with "=".
    Do you know the difference?

    And another suggestion:
    Many "else if" statements can be written more elegant in a switch statement (but don't forget the "break"'s).

    With friendly regards
    Programartist

  6. #6
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: Problem with coding from a beginner

    You have extra braces. Your code
    Code:
    if (x == 1);
    {
    		dbLoadBitmap("RomanNumber1.bmp",0);
    }
    else
    {
    if (x = 2);
    {
    		dbLoadBitmap("RomanNumber2.bmp",2);
    }
    else
    {
    if (x = 3);
    {
    	dbLoadBitmap ("RomanNumber3.bmp",3);
    }
    else
    {
    Lose all the ones in red, and the rest like that.

Tags for this Thread

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

Featured