读书人

初学者求教!

发布时间: 2012-02-12 17:16:34 作者: rapoo

菜鸟求教!!!!
from2的一个edit2 要用得到 from1 的edit1 的值

edit2 = from1-> edit1 ;

这样怎么不行呀 要怎么办?


[解决办法]
打开CB,新建一个工程,再新建立一个FORM2
在FORM1上拖一个TEXTBOX,再拖一个BUTTON
#include <vcl.h>
#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-> Show();
}


在FORM2上拖一个BUTTON
//---------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit2.h "
#include "Unit1.h "
//---------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm "
TForm2 *Form2;
//---------------------------------------
__fastcall TForm2::TForm2(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------

void __fastcall TForm2::Button1Click(TObject *Sender)
{
TEdit *edit2 = Form1-> Edit1;
ShowMessage(edit2-> Text);
}
//---------------------------------------


读书人网 >C++ Builder

热点推荐