Since you want to check whether textboxes contains any value or not your code should do the job. You should be more specific about the error you are having. You can also do:
if(textBox1.Text == string.Empty || textBox2.Text == string.Empty)
{
MessageBox.Show("You must enter a value into both boxes");
}
EDIT 2: based on @JonSkeet comments:
Usage of string.Compare is not required as per OP's original unedited post. String.Equals should do the job if one wants to compare strings, and StringComparison
may be used to ignore case for the comparison. string.Compare should be used for order comparison.
Originally the question contain this comparison,
string testString = "This is a test";
string testString2 = "This is not a test";
if (testString == testString2)
{
//do some stuff;
}
the if statement can be replaced with
if(testString.Equals(testString2))
or following to ignore case.
if(testString.Equals(testString2,StringComparison.InvariantCultureIgnoreCase))