解决方案 »
- delphi有像文件浏览的控件吗?
- 招聘开发DELPHI(北京)
- 关于数据集的操作问题~~COMING
- jpg图片添加文字???
- 100分求教
- 这个控件在Windows里很常见,但我不知道它是什么控件?谁能帮帮我?
- 组件开发问题:使用RegisterPropertyEditor必须USES DesignIntf文件,运行时报错:找不到ComponentDesigner文件
- 大家在做三层结构是遇到这种问题了吗?进去看。
- 你找出这个错误我给你100分
- 我写了一个很小的程序,可是有300K,请问各位,如何能更小?
- 寻找installshield developer 8 安装password 及序列号
- 请教高手:idFTP.put 假死无反应
combobox.InsertItemValue(10, 'AAA', 'AAA');用Ccombobox的InsertItemValue方法,
方法方法参数如下:
InsertItemValue(Index: Integer; const Item, Value: string)
因为ComboBox1为空时或者combobox的intems不超过10时插入会报错
你内容没有这么多当然会出错,你要盖楼,1楼没盖就盖10楼,你说可以吗
如果去序号可以用ComboBox1.ItemIndex+1自带的combobox1只有items,而没有values,只能取items和索引,而不能取自定义的序号
如果要取items和values要使用第三方控件
取的时候用combobox.items.Objects[index]
没有10行的时候,插入到第几行!
add加后面,insert直接插入
抱歉,我搞错了,Raize控件RzComboBox才有这个方法
insert()
else
Add();
1、创建MyList:TStringlist
2、在MyList插入操作
3、 ComboBox.Items.addstrings(Mylist)
begin
ComboBox1.AddItem('afsdf',TObject(10));
end;procedure TForm1.Button2Click(Sender: TObject);
begin
ComboBox1.Items.Objects[10];
end;先单击Button1 再单点button2
我的测试DEMO如下:procedure TForm1.Button2Click(Sender: TObject);
var
MyList:TStringlist;
begin
//ComboBox1.Items.Objects[10];
MyList:=TStringList.Create();
MyList.Add('fasf');
MyList.Add('aaa');
MyList.Add('aa');
MyList.Insert(10,'fdsafdsa');
ComboBox1.Items.AddStrings(MyList);
MyList.Free;
end;我想达到的目标是:前10行中其中有三行才有数据,但是我又在第10行中添加数据,应该怎么样做的问题;且4-9行为NIL
http://blog.csdn.net/chinawcs/article/details/6610754还可以用 三方组件解决这个 比如 ehlib中的TDBComboBoxEh while not Ado.Eof do
begin
cbo.Items.Add(Ado.Fields[1].AsString);
cbo.KeyItems.Add(Ado.Fields[0].AsString);
Ado.Next;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
RzComboBox1.InsertItemValue(0,'aa','bb');
end;procedure TForm1.Button2Click(Sender: TObject);
begin
ShowMessage(RzComboBox1.Values.Strings[RzComboBox1.itemindex] );
end;
方法都有三种了 楼主可以结贴了
ComboBox1.Items.Insert(9,'AAA');
吧