Need some help with code errors in college project

The code is as follows.

 for (int i = 0; i < strLen; i++) { result = wordToGuess.IndexOf(guessedLetter, foundLen, strLen - foundLen); //if the letter guessed is in the word if (result != -1) { foundLen = result + 1; counter++; newChar = wordToGuess.Substring((result), 1); //removes the * at the correct position **word = tbWord.Remove(result, 1);** //inserts the letter in place of * **word = tbWord.Insert(result, newChar);** guessedCorrectlyCounter++; } } 

The errors I'm getting are:

'System.Windows.Forms.TextBox' does not contain a definition for 'Remove' and no extension method 'Remove' accepting a first argument of type 'System.Windows.Forms.TextBox' could be found (are you missing a using directive or an assembly reference?)

&

'System.Windows.Forms.TextBox' does not contain a definition for 'Insert' and no extension method 'Insert' accepting a first argument of type 'System.Windows.Forms.TextBox' could be found (are you missing a using directive or an assembly reference?)

I'm not sure what's going on. I've googled the error and Some people with similar issues were told their .NET framework was too low. I checked and mine is 4.0

Any help is appreciated!

by GnusmasAikon via /r/csharp

Leave a Reply