如何在新增Memo.Lines加入篩選 |
答題得分者是:shunaaron
|
lovemari
中階會員 發表:134 回覆:224 積分:76 註冊:2005-08-18 發送簡訊給我 |
小弟希望每筆Edit1 輸入的序號只能唯一性
如果已經存入Memo 就不能再輸入 那下列程式碼 我該怎麼修改呢?? 因為目前下列方式還是會重複序號的存入 [code delphi] if Memo1.Lines.Text = Edit1.Text then begin showmessage('該序號已輸入') end else Memo1.Lines.Add(Edit1.Text); Edit1.Clear; end; end; [/code]
------
Program : Delphi 7 DataBase : Oracle 9i Client : ClientDataSet |
st33chen
尊榮會員 發表:15 回覆:591 積分:1201 註冊:2005-09-30 發送簡訊給我 |
------
IS IT WHAT IT IS 我是 李慕白 請倒著唸. 又想把老話拿出來說, 請用台語發音 : 專家專家全是ROBOT CAR (滷肉腳啦); 都已接手這麼久了, 績效還是那麼爛, 講話還那麼大聲. |
shunaaron
高階會員 發表:13 回覆:94 積分:106 註冊:2006-10-06 發送簡訊給我 |
[code delphi] procedure TForm1.Edit1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); Var ttIndex : Integer; begin if key = 13 then begin ttIndex := Memo1.Lines.IndexOf(trim(Edit1.Text)); if ttIndex = -1 then Memo1.Lines.Add(trim(Edit1.Text)) else ShowMessage('此序號已輸入過'); end; end; [/code]
------
程式沒有這麼難 只是還沒打通其中要絕 |
lovemari
中階會員 發表:134 回覆:224 積分:76 註冊:2005-08-18 發送簡訊給我 |
|
christie
資深會員 發表:30 回覆:299 積分:475 註冊:2005-03-25 發送簡訊給我 |
TStrings
IndexOf method Gets the index position of the first string matching the given string. Or -1 if not found. ===================引 用 lovemari 文 章===================
------
What do we live for if not to make life less difficult for each other? |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |