问题一:
StringGrid的某个列我设置成只读的,但我要想用combobox把值给赋上去。行不行?怎么做?
问题二:
怎么控制不能输入两个连续的点(.)如:8.5不能8..5?也是在StringGrid里
我是
if stringgrid1.col = 5  then  //这列是记录工时的,到时候要计算的,要
                              合法的浮点数
begin
  if not (key in ['0','1','2','3','4','5','6','7','8','9','.',#13,#8]) then
   key := #0;
end;

解决方案 »

  1.   

    1、Cells[col,row]:='字符串';行与列号自己取得,
       可以在一个Sel*的事件中取得。
    2、自己设置计数。每次击键时,检查'.'的个数;
    3、你的语句可以简化
    if stringgrid1.col = 5  then  //这列是记录工时的,到时候要计算的,要
                                  合法的浮点数
    begin
      if key='.'
      then for i:=1 to Length(tmpStr) do 
       if (tmpStr[i]='.')
       then begin
        Key=#0;
        Exit;
       end;  if not (key in ['0'..'9','.',#13,#8]) then
       key := #0;
    end;
      

  2.   

    第一个问题很容易,你自己看一下属性的例子就可以了;
    第二个问题三楼的说得很明白,你也可以这样:
    if stringgrid1.col = 5  then  begin
      if key='.'
      then 
        begin
         if pos('.',tmpStr)>0 then
           key:=#0;
       end;  if not (key in ['0'..'9','.',#13,#8]) then
       key := #0;
    end;
      

  3.   

    上面几位大虾的“tmpStr”,我真不知道是什么东西
    没有用过,能不能注释一下啊?
    begin
      if key='.'
      then for i:=1 to Length(tmpStr) do //???
       if (tmpStr[i]='.')
       then begin
        Key=#0;
        Exit;
       end;if key='.'
      then 
        begin
         if pos('.',tmpStr)>0 then   //???
           key:=#0;
       end;