IndexOf有几种方法的
你用的是 public int IndexOf(字符串, 起始位置, 指定数量的字符);上面的值肯定都等于-1啦!这样写就能查到了
int FirstSix=sText.IndexOf("6",0);

解决方案 »

  1.   

    你对帮助的理解有误。下面是MSDN的帮助文档,显然和你想象的出入很大。
    Reports the index of the first occurrence of the specified String in this instance. The search starts at a specified character position and examines a specified number of character positions.
      

  2.   

    int SecondSix=sText.IndexOf("6",FirstSix);
      

  3.   

    string sText="236465";
    int lengs=sText.Length;
    int FirstSix=sText.IndexOf("6",0,lengs);
    int SecondSix=sText.IndexOf("6",0,lengs);
      

  4.   

    正如wuye(午夜寻欢) 和Jonly() 所说的:
    不过稍微改一下。string sText="236465";
    int lengs=sText.Length;
    int FirstSix=sText.IndexOf("6");
    int SecondSix=sText.IndexOf("6",FirstSix+1);