線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:708
推到 Plurk!
推到 Facebook!

如何使第二個Form可以存第一個Form上的Memo物件?

答題得分者是:Zard
黑輪
中階會員


發表:135
回覆:188
積分:64
註冊:2004-01-29

發送簡訊給我
#1 引用回覆 回覆 發表時間:2004-10-29 21:29:06 IP:218.167.xxx.xxx 未訂閱
我在第一個Form執行Memo,之後呼叫第二個Form,想在第二個Form中存取第一個Form的Memo中的值,要如何做? ps:我把第二個Form的h檔給include給第一個Form,可以順利呼叫第二個Form
Zard
尊榮會員


發表:24
回覆:396
積分:539
註冊:2003-11-26

發送簡訊給我
#2 引用回覆 回覆 發表時間:2004-10-29 21:37:12 IP:61.64.xxx.xxx 未訂閱
引言: 我在第一個Form執行Memo,之後呼叫第二個Form,想在第二個Form中存取第一個Form的Memo中的值,要如何做? ps:我把第二個Form的h檔給include給第一個Form,可以順利呼叫第二個Form
//---------------------------------------------------------------------------
// Unit1.cpp
#include 
#pragma hdrstop    #include "Unit1.h"
#include "Unit2.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
  : TForm(Owner)
{
}
//---------------------------------------------------------------------------    void __fastcall TForm1::Button1Click(TObject *Sender)
{
  Form2->Visible = TRUE;  
}
//---------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
//---------------------------------------------------------------------------
// Unit2.cpp
#include 
#pragma hdrstop    #include "Unit1.h"
#include "Unit2.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm2 *Form2;
//---------------------------------------------------------------------------
__fastcall TForm2::TForm2(TComponent* Owner)
  : TForm(Owner)
{
}
//---------------------------------------------------------------------------    void __fastcall TForm2::Button1Click(TObject *Sender)
{
  Form1->Memo1->Text = "Test";  
}
//---------------------------------------------------------------------------    
黑輪
中階會員


發表:135
回覆:188
積分:64
註冊:2004-01-29

發送簡訊給我
#3 引用回覆 回覆 發表時間:2004-10-29 21:49:26 IP:218.167.xxx.xxx 未訂閱
我include 是用 < > ,與用此 " " 差別在哪啊?
Zard
尊榮會員


發表:24
回覆:396
積分:539
註冊:2003-11-26

發送簡訊給我
#4 引用回覆 回覆 發表時間:2004-10-29 22:01:21 IP:61.64.xxx.xxx 未訂閱
引言: 我include 是用 < > ,與用此 " " 差別在哪啊?
搜尋該header檔的方式不一樣. BCB裡的完整敘述: The difference between the < header_name > and "header_name" formats lies in the searching algorithm employed in trying to locate the include file. The < header_name > version specifies a standard include file; the search is made successively in each of the include directories in the order they are defined. If the file is not located in any of the default directories, an error message is issued. The "header_name" version specifies a user-supplied include file; the file is searched in the following order: - in the same directory of the file that contains the #include statement - in the directories of files that include (#include) that file - the current directory - along the path specified by the /I compiler option
黑輪
中階會員


發表:135
回覆:188
積分:64
註冊:2004-01-29

發送簡訊給我
#5 引用回覆 回覆 發表時間:2004-10-29 22:23:19 IP:218.167.xxx.xxx 未訂閱
了解~感謝您哦~
系統時間:2024-06-28 2:28:56
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!