如题

解决方案 »

  1.   

    ListBox中并没有FINDBYTEXT这个定义呀,运行不通
      

  2.   

    foreach (ListItem li in ListBox1.Items)
            {
                if (li.Text == "bb")
                {
                    string Number = li.Value;
                    break;
                }
            }
      

  3.   

    foreach (ListItem li in ListBox1.Items) 
            { 
                if (li.Text == "bb") 
                { 
                    string Number = li.Value; 
                    break; 
                } 
            }Number返回的是“bb"值,不是其编号
      

  4.   

    你什么控件啊,web的话就是有FindByText.。你用我回的测不行的话把你测的代码发出来
      

  5.   

    string STR_PP(  string Str,
    string XYZ_File,
    string GRD_File,
    string WMF_File,
    string in_BLN_File,
    string out_BLN_File,
    string Lvl_C_File,
    string Lvl_F_File){
      int k0 = Str.IndexOf("[");
      int k1 = Str.IndexOf("]");
      string FileName = Str.Substring(k0, k1-k0+1);
      int r=lb.Items.IndexOf(lb.FindByText(FileName)) ;////
        string SSS;
      switch (r){
         case 0 : SSS = GRD_File; break;
         case 1 : SSS = XYZ_File; break;
         case 2 : SSS = WMF_File; break;
         case 3 : SSS = in_BLN_File; break;
         case 4 : SSS = out_BLN_File; break;
         case 5 : SSS = Lvl_C_File; break;
         case 6 : SSS = Lvl_F_File; break;
         //case 7 : SSS = Err_File; break;
         //case 8 : SSS = Num_File; break;
        // case 9 : SSS = XYZ_File_3; break;
        // case 10 : SSS = CLR_File; break;
        }
      string Re_Str = Str.Substring(1, k0-1) + SSS + Str.Substring(k1+1, 30);
      return Re_Str;
      
    }
    提示LISTBOX控件没有FINDBYTEXT这一定义
      

  6.   

    错误 7 “System.Web.UI.WebControls.ListBox”并不包含“FindByText”的定义 E:\dzcc\WebApplication1\WebApplication1\Default.aspx.cs 569 43 WebApplication1
      

  7.   

     lb.Items.IndexOf(lb.Items.FindByText("ss"));少写了,sorry