G
GK
Is there a way I can call a variable from other namespace? thanks.
GK said:Is there a way I can call a variable from other namespace? thanks.
GK said:I was hoping the answer will be a simple one.
here is the full question:
I need to add an additional feature to a large application. in stead of
insert the new code into part of the original application, I created a new
project with the features needed. The original application is C# in VS2005,
my new project is also c# in VS2005. I inserted my new project into the
original solution. now, from the main form (say FormMain) of the original
application. I need to initial a call to a form(say FormA) that belongs to
the new project, and hide the FormMain. when the FormA is closed, I put a
code on FormA_FormClosing to show the FormMain.
Peter Duniho said:GK wrote:
namespace OriginalApplication
{
class FormMain
{
void button1_Click(object sender, EventArgs e)
{
NewProject.FormA d = new NewProject.FormA();
d.FormClosed += (sender, e) => this.Show();
this.Hide();
d.Show();
}
}
}
namespace NewProject
{
class FormA
{
// don't reference FormMain here at all
}
}
Of course, to the extent that this problem came up because you tried to
add code to the original application, but without putting that code into
the same project as the original application, you could also fix the
problem simply by not doing that. Instead, put the new code in the old
project, rather than it's own project.
Finn said:Could'nt he stille seperate the code i different project's and use the same
Namespace in both project's. That would do the same or ??
GK said:Peter,
You understand my problem very well. would you explain this line:
d.FormClosed += (sender, e) => this.Show();
I was not able to have it compiled.