我又两个Form,在Form1中有一个ComboBox已在IDE环境中设定了内容,Form2中有一个
listbox,现在要做到把listbox的内容传入combobox中,我的代码如下
     Form1.ComboBox1.Clear;
      for i:=0 to ListBox2.Count-1 do
         Form1.ComboBox1.Items.Add(ListBox2.Items[i]);
编译时没错,运行时在clear处报内存错,怎么回事?

解决方案 »

  1.   


         Form1.ComboBox1.Items.Clear;
          for i:=0 to ListBox2.Count-1 do
             Form1.ComboBox1.Items.Add(ListBox2.Items[i]);
      

  2.   

    Form1.ComboBox1.Items.Clear;
          for i:=0 to ListBox2.Count-1 do
             Form1.ComboBox1.Items.Add(ListBox2.Items[i]);
      

  3.   

    form1.combobox1.items.assigned(listbox2.items);
      

  4.   

    好象这样也行
         Form1.ComboBox1.Items.Clear;
         Form1.ComboBox1.Items.Add(ListBox2.Items);
      

  5.   

    更改form1.combobox1.items.assign(listbox2.items);
      

  6.   


         Form1.ComboBox1.Items.Clear;
          for i:=0 to ListBox2.Count-1 do
             Form1.ComboBox1.Items.Add(ListBox2.Items.Strings[ii]);
      

  7.   

    试过了
        Form1.ComboBox1.Items.Clear;
        Form1.ComboBox1.Items.Assign(ListBox2.Items);
         

        Form1.ComboBox1.Items.Clear;
        for i:=0 to ListBox2.Count - 1 do
        Form1.ComboBox1.Items.Add(ListBox2.Items[i])
    都行,楼主的错是其他的错,给出错误信息吧
      

  8.   

    我是了确实不行,请问各位大哥你们两个Form的窗口属性是怎么摄制的
      

  9.   

    Form2包含Form1
    如果你觉得不保险,再把Form2也包含进Form1呀