我想用一個loop去將所有edit clear data,但是... |
答題得分者是:Fishman
|
BorlandUser
中階會員 發表:148 回覆:217 積分:73 註冊:2004-02-19 發送簡訊給我 |
With MainUserForm Do
Begin
For intX := 0 To ControlCount - 1 Do
Begin
If (Controls[intX] Is TEdit) Then
TEdit(Controls[intX]).Clear; If (Controls[intX] Is TMemo) Then
TMemo(Controls[intX]).Clear;
End;
End; 已經錯了...在去到for這行就錯了..什麼麼memory read問題...?why
|
Fishman
尊榮會員 發表:120 回覆:1949 積分:2163 註冊:2006-10-28 發送簡訊給我 |
Hi BorlandUser,
procedure TForm1.Button53Click(Sender: TObject); VAR I : Integer; begin For I := 0 to Form1.ComponentCount - 1 DO BEGIN IF Self.Components[I] Is TEdit THEN TEdit(Form1.Components[I]).Clear ELSE IF Self.Components[I] Is TMemo THEN TMemo(Form1.Components[I]).Clear; END; end;ComponentCount : Indicates the number of components owned by the component. ControlCount : Returns the number of child controls. ---------------------------------- 小弟才疏學淺,若有謬誤尚請不吝指教 ----------------------------------
------
Fishman |
hahalin
版主 發表:295 回覆:1698 積分:823 註冊:2002-04-14 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |