You need to load the new result of the dialog.
int guessTheNumber = Convert.ToInt32(txtNumberGuess.Text);
DialogResult dialogResult;
do
{
Random newNumberGenerator = new Random();
number = newNumberGenerator.Next(0, 101);
dialogResult = MessageBox.Show("Is number" + number.ToString() + " you are thinking about?", "Answer the question!", MessageBoxButtons.YesNo);
} while (dialogResult == DialogResult.No);
MessageBox.Show("Congratulation! You guessed the number!!");
The do
loop will execute the code first, and then check the condition. THis will also prevent having the same piece of code at different places, meaning the same.