Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

'string' does not contain a definition for 'Chars' - WHAT??

Status
Not open for further replies.

TheDust

Programmer
Aug 12, 2002
217
US
Yes, I am getting this error, Error CS0117: 'string' does not contain a definition for 'Chars'. I'm at a loss here... anyone know what I'm missing here??? (it's C#)

using System;
using System.Data;
using System.Data.OleDb;

public class classEditContact : System.Web.UI.Page {

string checkEscapeChars(string strInput) {
for (int x=0; x < (strInput.Length - 1); x++) {
if (strInput.Chars[x] == &quot;'&quot;) {
strInput.Insert(x, &quot;'&quot;);
}
}
return strInput;
}

}
If anyone can help me out here, it'd be much appreciated, cuz I'm kind of tearin' my hair out here...
Dust
 
The string object offers an index property directly on the object, so:

strInput.Chars[x]

should be:

strInput[x]

-paul
penny1.gif
penny1.gif

The answer to getting answered -- faq855-2992
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top