简单问题!!!!!!!!!! (15分)

  • 主题发起人 主题发起人 inbreak
  • 开始时间 开始时间
I

inbreak

Unregistered / Unconfirmed
GUEST, unregistred user!
我有一个 combobox 。。
style 属性为:csDropDownList
items 属性设置有
1
2
3
4
5
6
7
8
9
有一个edit1,,我想当 在 edit1 中输入一个数字(当然这个数字是1至9)时.。
combobox 的text 值就为等于我 edit1 中的数值。。。。

如:我在edit1 中输入5 .。那个 combobox 中的值也为5.。
 
你把combobox换成dblookupcombobox就行了。
 

ComboBox1.ItemIndex:=strtoint(edit1.text)-1;
 
ComboBox1.itemIndex:=ComboBox1.Items.IndexOf(edit1.text);
 
combobox.text:=edit1.text;
 
在EDIT的onChange或OnKeyPress中写代码
如:
procedure TForm1.Edit1Change(Sender: TObject);
begin
case StrToInt(Edit1.text) of
1,2,3,4,5,6,7,8,9 :ComboBox1.itemIndex:=ComboBox1.Items.IndexOf(edit1.text);
end;

end;
 
to ReallyFail:
非常感谢你!!!!!!!!

同时也感谢大家的参与,谢谢~~~~~~~~~~~~~~~
 
接受答案了.
 
后退
顶部