2011-12-21 63 views
-2

我已經使用delphi 2010創建了一個註冊表單,我不想讓我現有的用戶註冊使用他們的電子郵件。因此,如果任何註冊已經註冊的電子郵件將顯示形式pass_reset對話框。如何將行添加到delphi中的RichEdit組件?

uses 
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 
Dialogs, StdCtrls, GIFImg, ExtCtrls, pngimage, ComCtrls, FMTBcd, WideStrings, 
DBXMySql, DB, SqlExpr, MessageDigest_5, Types, ShellAPI, IdBaseComponent, 
IdComponent, IdIOHandler, IdIOHandlerSocket, IdIOHandlerStack, IdSSL, 
IdSSLOpenSSL, IdTCPConnection, IdTCPClient, IdExplicitTLSClientServerBase, 
IdMessageClient, IdSMTPBase, IdSMTP, IdMessage,**pass_reset;** 

{Checking wether email exist} 

SQLQuery2.SQL.Text := 'SELECT * from registered where email="'+email+'"'; 
SQLQuery2.Open; 
count := SQLQuery2.RecordCount; 

{if email exit bfore display message already exist} 

if (count>0) then 
begin 
PassReset.Show; 
end; 

如何在pass_reset形式

對不起[email protected]已經在我們的數據庫(使用TRichEdit成分)

喜歡的東西

procedure TPassReset.Rich_customExistBeforeChange(Sender: TObject); 
begin 
email := form_signup.ed_email.text; 
RichEdit1.Append('Hello "'+email+'" it seem that you''re already registered with us'); 
end; 

但它寫沒有工作。

+1

你的意思是你不知道如何去'RichEdit.Lines.Add(「我有豐富的格式信息」);' – 2011-12-21 14:32:19

+1

這RichEdit.Lines.Add,不RichEdit1.Append。您正在修改Lines屬性,而不是RichEdit控件。 – 2011-12-21 14:36:42

+0

這是workiçng確定當用作一些按鈕的Click事件,但在哪裏把這行代碼爲了自動更改表單創建我試着FormCreate但它沒有工作 – 2011-12-21 14:50:52

回答

3

這是你想要的嗎?

RichEdit1.Lines.Add('sorry [email protected] is already in our database'); 

它會將一行添加到TRichEdit RichEdit1

假設你的代碼PassReset.Show有效,你可以從同一個地方修改你的TRichEdit。

if (count>0) then 
begin 
    PassReset.Show; 
    PassReset.RichEdit1.Lines.Add('sorry [email protected] is in use'); 
end; 
相關問題