用 parent.name:if combobox.parent.name="GroupBox1" then
begin
   ......
end
else if .....end;

解决方案 »

  1.   

    if ComboBox1.Parent is TGroupBox then
        ShowMessage(TGroupBox(ComboBox1.Parent).Name);
      

  2.   

    if ComboBox1.Parent.Name='GroupBox1' then
    begin
    end
    else if ComboBox1.Parent.Name='GroupBox2' then
    begin
    end
      

  3.   

    if combobox1.Parent = groupBox1 then
       showmessage('pk')
      

  4.   

    with Form1 do
      begin
        for j := ComponentCount - 1 downto 0 do
          if (Components[j] is TDBComboBox) then
               begin
                 if TDBComboBox(Components[j]).parent.name='GroupBox2'  then  
                   begin
                      此处不执行??????该如何该呢
                   end ;
      

  5.   

    with Form1 do
      begin
        for j := ComponentCount - 1 downto 0 do
          if (Components[j] is TDBComboBox) then
               begin
                 if TDBComboBox(Components[j]).parent=GroupBox2  then  
                   begin
                      此处不执行??????该如何该呢
                   end ;
      

  6.   

    with Form1 do
      begin
        for j := ComponentCount - 1 downto 0 do
          if (Components[j] is TDBComboBox) then
               begin
                 showmessage(Components[j]).parent.name);//看看提示是什么先
                 if TDBComboBox(Components[j]).parent=GroupBox2  then  
                   begin
                      此处不执行??????该如何该呢
                   end ;
      

  7.   

    我这里试没有问题...用showmessage(TDBComboBox(Components[j]).parent.name);看看