locked
The name 'dividedRightLabel' does not exist in the current context_ RRS feed

  • Question

  • In C# express edition I get this error "The name 'dividedRightLabel' does not exist in the current context." Intellisense doesn't list dividedRightLabel as an option but tutorial for C# express requires it for this exercise. When I paste this code listed below, I get an error message:

     " Error 1 The name 'dividedRightLabel' does not exist in the current context C:\Users\labrat\Documents\Visual Studio 2010\Projects\Math Quiz\Math Quiz\Form1.cs 70 13 Math Quiz "

     

     

     // Fill in the division problem.
        divisor = randomizer.Next(2, 11);
        int temporaryQuotient = randomizer.Next(2, 11);
        dividend = divisor * temporaryQuotient;
        dividedLeftLabel.Text = dividend.ToString();
        dividedRightLabel.Text = divisor.ToString();
        quotient.Value = 0;

    Tuesday, October 5, 2010 8:20 PM

Answers

  • > When I paste this code listed below

    Put a Label control onto the Visual Studio designer for the Form on which you pasted this code.  Set the Name property of that Label using the designer to dividedLeftLabel.Text.  Do the same for dividedRightLabel.

     

    Wednesday, October 6, 2010 2:25 AM
  • The solution you provided did work.

    Thank You.

    • Marked as answer by sal-d-man Tuesday, October 12, 2010 4:17 PM
    Tuesday, October 12, 2010 4:16 PM

All replies

  • > When I paste this code listed below

    Put a Label control onto the Visual Studio designer for the Form on which you pasted this code.  Set the Name property of that Label using the designer to dividedLeftLabel.Text.  Do the same for dividedRightLabel.

     

    Wednesday, October 6, 2010 2:25 AM
  • Hi sal-d-man,

    Welcome to MSDN Forums!

     

    Does the reply from BinaryCoder can help you to solve your question? If so, please don’t forget mark/vote the replies which helped you, and this will encourage the other community members to join in discussion and help each one.

     

    If there’s anything unclear, please feel free to let me know.

     

    Best wishes,

    Mike

    *****************************************************

    [All-In-One Code Framework]

    Sample world! You will get more from this world!

    Welcome to the new world!

    Friday, October 8, 2010 7:03 AM
    Moderator
  • The solution you provided did work.

    Thank You.

    • Marked as answer by sal-d-man Tuesday, October 12, 2010 4:17 PM
    Tuesday, October 12, 2010 4:16 PM
  • The solution from BinaryCoder did work.

    Thank You.

    Tuesday, October 12, 2010 4:18 PM