新手請教COMBOBOX問題 |
答題得分者是:jow
|
cnnick
一般會員 發表:1 回覆:1 積分:0 註冊:2006-09-26 發送簡訊給我 |
if not adoquery1.IsEmpty then
begin tc:=tcombobox.Create(nil); combobox1.Clear; adoquery1.First; while not adoquery1.Eof do begin tc.Items.Add(adoquery1.Fields[0].Asstring); adoquery1.Next; end; combobox1:=tc; end; 出錯:control has no parent window 請問各位高手出錯原因? |
yubad2000
中階會員 發表:0 回覆:44 積分:78 註冊:2007-09-30 發送簡訊給我 |
You might need to attach this control object to a Form or Window by calling "tc:=tcombobox.Create(form1);" ===================引 用 cnnick 文 章=================== if not adoquery1.IsEmpty then begin tc:=tcombobox.Create(nil); combobox1.Clear; adoquery1.First; while not adoquery1.Eof do begin tc.Items.Add(adoquery1.Fields[0].Asstring); adoquery1.Next; end; combobox1:=tc; end; 出錯:control has no parent window 請問各位高手出錯原因?
------
===波士頓夜未眠=== What a wonderful world!! Jazz up the world with jazz!! ================== When I am not programming... you can find me here: http://www.holy-war.de/EN/World3/bin/?advertiser=63190 |
jow
尊榮會員 發表:66 回覆:751 積分:1253 註冊:2002-03-13 發送簡訊給我 |
操作資料(字串)不要用TComboBox, 請改用 TStringList
最後再顯示結果.... [code delphi] procedure TForm1.Button1Click(Sender: TObject); var L: TStringList; begin if not AdoQuery1.IsEmpty then begin L := TStringList.Create; try AdoQuery1.First; while not AdoQuery1.Eof do begin L.Add(AdoQuery1.Fields[0].Asstring); AdoQuery1.Next; end; ComboBox1.Items.Text := L.Text; finally FreeAndNil(L); end; end; end; [/code] ===================引 用 cnnick 文 章=================== if not adoquery1.IsEmpty then begin tc:=tcombobox.Create(nil); combobox1.Clear; adoquery1.First; while not adoquery1.Eof do begin tc.Items.Add(adoquery1.Fields[0].Asstring); adoquery1.Next; end; combobox1:=tc; end; 出錯:control has no parent window 請問各位高手出錯原因? |
cnnick
一般會員 發表:1 回覆:1 積分:0 註冊:2006-09-26 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |