简体   繁体   中英

Trying to debug this source code {c#}

Below is a portion of my source code and I am trying to debug it and can't figure out what to do. I have run the debugger that I use on visual studio and when it pops up it says "does not exists in the current context" at gameB and when I look at the possible fixes, I choose to make an existence in the Main Window and then it underlines the rest of that line except the arguments. And this happens anywhere there is a gameB.

Source code:

public void startGame()
{

    // Clean up the display
    gameB.resetGameBoard(lettersUsed);

    // Reset the game state values
    turnNumber = 1;
    lettersUsed = 0;
    displayPlayerTurn(1);

    playerOneScore = 0;
    playerTwoScore = 0;
    lblP1_Score.Content = "0";
    lblP2_Score.Content = "0";


    // Show player one's turn
    gameB.setupPlayerLetters(1, ref lettersUsed);
}

Please help!

Error is pretty self explanatory as it says that you need to create a variable of type gameB since it doesn't exist in your startGame() function scope.

"gameB does not exists in the current context"

To debug, right click on a code line and select Add Breakpoint . Run your application and start debugging.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM