全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:2549
推到 Plurk!
推到 Facebook!

MessageBox 中可用變數嗎????

答題得分者是:ccchen
kenji
一般會員


發表:32
回覆:44
積分:20
註冊:2002-08-05

發送簡訊給我
#1 引用回覆 回覆 發表時間:2002-08-27 10:19:31 IP:61.225.xxx.xxx 未訂閱
我想要在MessageBox中提醒使用者是要刪那一筆的資料,不要刪錯哦! 可是怎麼都加不上變數,有請各位高手指點...... xyz:=DBGrid1.DataSource.DataSet.Fields[3].Value; if Application.MessageBox('確定要刪除?','確認',MB_YesNo MB_DEFBUTTON2 MB_IconQuestion MB_ApplModal)=IDYES then begin .............. end;
andersonhsieh
版主


發表:33
回覆:531
積分:439
註冊:2002-06-10

發送簡訊給我
#2 引用回覆 回覆 發表時間:2002-08-27 10:31:40 IP:211.20.xxx.xxx 未訂閱
提供delphi的help給你參考
 
Displays a specified message to the user.    function MessageBox(const Text, Caption: PChar; Flags: Longint): Integer;    Description    Use MessageBox to display a generic dialog box a message and one or more buttons. Caption is the caption of the dialog box and is optional.    MessageBox is an encapsulation of the Windows API MessageBox function. TApplications encapsulation of MessageBox automatically supplies the missing window handle parameter needed for the Windows API function.    The value of the Text parameter is the message, which can be longer than 255 characters if necessary. Long messages are automatically wrapped in the message box. The value of the Caption property is the caption that appears in the title bar of the dialog box. Captions can be longer than 255 characters, but don't wrap. A long caption results in a wide message box.    To see the possible values of the Flags parameter, see the MessageBox function in the Windows API Help file. The corresponding parameter on the Windows function is called TextType. The values determine the buttons that appear in the message box and the behavior of the message box. These values can be combined to obtain the desired effect.    MessageBox returns 0 if there isnt enough memory to create the message box. Otherwise it returns one of the following values:    Value        Numeric value        Meaning    IDOK        1        The user chose the OK button.
IDCANCEL        2        The user chose the Cancel button.
IDABORT        3        The user chose the Abort button.
IDRETRY        4        The user chose the Retry button.
IDIGNORE        5        The user chose the Ignore button.
IDYES        6        The user chose the Yes button.
IDNO        7        The user chose the No button.
@@~~飛翔在天際的精靈~~@@
------
@@~~飛翔在天際的精靈~~@@
kenji
一般會員


發表:32
回覆:44
積分:20
註冊:2002-08-05

發送簡訊給我
#3 引用回覆 回覆 發表時間:2002-08-27 21:02:09 IP:61.217.xxx.xxx 未訂閱
還是不太懂耶`~~能不能說明白一點丫~~~~~~
ccchen
版主


發表:61
回覆:940
積分:1394
註冊:2002-04-15

發送簡訊給我
#4 引用回覆 回覆 發表時間:2002-08-27 21:10:22 IP:203.217.xxx.xxx 未訂閱
xyz:=DBGrid1.DataSource.DataSet.Fields[3].Value;
if Application.MessageBox('確定要刪除?' VarToStr(xyz),'確認',MB_YesNo   MB_DEFBUTTON2  MB_IconQuestion MB_ApplModal)=IDYES then
begin
..............
end;
P.D.
版主


發表:603
回覆:4038
積分:3874
註冊:2006-10-31

發送簡訊給我
#5 引用回覆 回覆 發表時間:2002-08-27 21:59:34 IP:210.85.xxx.xxx 未訂閱
引言:
xyz:=DBGrid1.DataSource.DataSet.Fields[3].Value;
if Application.MessageBox('確定要刪除?' VarToStr(xyz),'確認',MB_YesNo   MB_DEFBUTTON2  MB_IconQuestion MB_ApplModal)=IDYES then
begin
..............
end;
對不起, 補充一下, 這列應該要加上 pChar() 格式才對, 如果我沒記錯, 在 MessageBox中的 Text, 或 Caption, 如果有使用到變數時, 應以 pChar()函數再做轉換 if Application.MessageBox(pChar('確定要刪除?' VarToStr(xyz)),'確認',MB_YesNo MB_DEFBUTTON2 MB_IconQuestion MB_ApplModal)=IDYES
ccchen
版主


發表:61
回覆:940
積分:1394
註冊:2002-04-15

發送簡訊給我
#6 引用回覆 回覆 發表時間:2002-08-27 22:23:55 IP:203.217.xxx.xxx 未訂閱
補充一下, 這列應該要加上 pChar() 格式才對 沒錯是我疏忽了, 原型為 function MessageBox(const Text, Caption: PChar; Flags: Longint = MB_OK): Integer; 由於為const pchar, 因此const 字串可直接傳入變數則須轉型如P.D所言
系統時間:2024-05-06 7:35:20
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!