case语句中的变量必须是序数类型.

解决方案 »

  1.   

    case condition of 语句中condition不能用字符串类型的
      

  2.   

    那怎么办呀?我要对s:string里的内容做判断并执行不同的操作呀
      

  3.   

    用If呀!if XX then
    else if XX then
    else if xx then
    不是一样吗!
      

  4.   

    将s转化为Integer不就行了吗?
    用StrToInt(s)
    然后再对name,等进行转化Integer不就行了吗
      

  5.   

    如果你一定要用CASE 的话,
    可以如下死办法:
    ...
    var 
      s:array[1..num_of_strings] of string;
      index_s:1..num_of_strings;
    begin
      ...
      s[1]:='name';
      s[2]:='address';
      s[3]:='telphone';
      ...
      case index_s of
        1:begin ... end;
        2:begin ... end;
        3:begin ... end;
        ...
      end;
      ...
    end;
      

  6.   

    同意Frazy(不要耍我*我会晕倒) 的见解,同时加Checkbox \Checkbox等控件以增强界面友好
      

  7.   

    可以用枚举啊!
    type
      Tcolumn=(name,address,telphone);
    var
      s:Tcolumn;
    begin
      case s of 
        name:begin
             
             end;
        address:begin
                
                end;
        telphone:begin             end;
    end;