编译器错误信息: CS0103: 当前上下文中不存在名称“InStr”源错误: 行 30: 
行 31:              
行 32:    while (InStr(subject,";"))
行 33:         xx=InStr(subject,";");
行 34:         subj = left(subject, xx);
 
大哥门,帮忙解决一下啊!谢谢

解决方案 »

  1.   

    Instr方法是6.0时代的,在.Net下使用IndexOfwhile (subject.IndexOf(";")<>-1)
    xx=subject.IndexOf(";")
    subj=subject.SubString(0,xx-1)
      

  2.   

    编译器错误信息: CS1525: 无效的表达式项“>”源错误: 行 29:         string subj="";
    行 30:                   
    行 31:     while (subject.IndexOf(";")<>-1)
    行 32:         xx=InStr(subject,";");
    行 33:         subj = left(subject, xx);
     
    现在的错误显示如下,大哥,再帮帮忙哈!
      

  3.   

    你用的是C#还是VB啊?如果是C#,应该是:while (subject.IndexOf(";")!=-1)
    xx=subject.IndexOf(";");subj=subject.SubString(0,xx-1);
      

  4.   

    while (subject.IndexOf(";")!=-1)
    xx=subject.IndexOf(";");subj=subject.SubString(0,xx-1);