首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ Builder >

初学者求教!

2012-02-12 
菜鸟求教!!!!from2的一个edit2要用得到from1的edit1的值edit2from1- edit1这样怎么不行呀要怎么办? [解

菜鸟求教!!!!
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);
}
//---------------------------------------


热点排行