1、在一个form窗体中,有3个combobox控件,combobox1要显示stu表中的xh字段,combobox2要显示ust表中的xm字段,combobox3要显示ust中的sup字段。如果只有一个combobox控件,我可以在FormShow中实现。2、在edit控件中,它的text中要只允许输入数字,并且要求保留小数2位,如何实现?不胜感激!!!
解决方案 »
- FastReport 脚本要打开两次!
- --------如何判断windows服务的状态???-------------
- adotable的active属性无法设置为 true
- 如何在动态数据集(ADOQuery)中增加计算字段?
- 如何MDI的主窗体的背景放入一个TWebBrowser
- Delphi CreateProcess 程序访问违例(RuntimeError)
- 急求:在DELPHI中怎么验证NT的登录账号是正确的?
- 那里有flatpanel控件和水晶控件下载
- 关于显示时间的问题。
- 如何做到完全隐藏硬盘分区,而不仅仅是在我的电脑里隐藏,急急急!(delphi)
- 帮我看一条SELECT语句.
- 求助下 DELPHI里如何实现客户显示屏的输出?
begin
if ((key < '0') or (key > '9')) and (key <> '.') and (key <> 退格键) then
key:= #0;
if (key='.') and (Pos('.', Edit.text) > 0) then
key:= #0;
if (Pos('.', Edit.text) > 0) and ((length(edit.text)-(pos('.', Edit.text))>=2) then
key:= #0;
end;以上为伪代码。未测试。
with AdoQuery1 do
begin
close;
sql.clear;
sql.add('select distinct xh from stu');
Open;
while not eof do
comboBox1.Items.add(FieldByName('xh').asString);
end;依此类推。
第二个下面的代码你看看啦 希望对你有帮助用一个TMaskEdit限制一下格式 再在OnKeyDown事件下写一个
if not (key in ['0'..'9',#8,'.']) then
begin
key:=0;
end;
with AdoQuery1 do
begin
close;
sql.clear;
sql.add('select distinct xh from stu');
Open;
while not eof do
bgein
comboBox1.Items.add(FieldByName('xh').asString);
next; //应该加个Next,不然只会显示一个记录...
end;
end;