Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Monday, August 25, 2014 3:47 PM
Hi i am new to c# i am making hospital database management system.i am working on four different department laboratory,pharmacy etc
what i want is to connect two different window form application.For example on my reception department which is window form application 1 i want to call the forms of window form application 2 on window form application 1.How can i do this
plx help as soon as possible.
All replies (9)
Monday, August 25, 2014 3:55 PM âś…Answered
When you say call.
You mean show?
I suggest yor best approach would be to re-factor and move eveything into the one solution.
You can have multiple projects in the one solution.
Hope that helps
Please don't forget to up vote answers you like or which help you and mark one(s) which answer your question.
Monday, August 25, 2014 3:54 PM
You need to use an instance of a form like in the coded below
Form 1
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
Form2 form2;
public Form1()
{
InitializeComponent();
form2 = new Form2(this);
}
private void button1_Click(object sender, EventArgs e)
{
form2.Show();
string results = form2.GetData();
}
}
}
Form 2
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form2 : Form
{
Form1 form1;
public Form2(Form1 nform1)
{
InitializeComponent();
this.FormClosing += new FormClosingEventHandler(Form2_FormClosing);
form1 = nform1;
form1.Hide();
}
private void Form2_FormClosing(object sender, FormClosingEventArgs e)
{
//stops for from closing
e.Cancel = true;
this.Hide();
}
public string GetData()
{
return "The quick brown fox jumped over the lazy dog";
}
}
}
jdweng
Tuesday, August 26, 2014 1:47 AM
You can have more than one form running in the same executable. And each form can be doing totally different things, or one form can be gathering information, it can call another form in the same executable solution and pass data to it or have the other form pass data back to the form that made the called.
You need to have all of these forms in the same executable solution so that they can communicate with each other. You would most likely need security in the solution so that Jane Blow receptionist couldn't go into the laboratory screens of the solution, which would be some kind of role based security.
I am going to be frank and honest with you. You don't seem to have the expertise programming wise to accomplish your goal if you are in here asking the questions that you are asking.
Maybe you need a .NET contractor with the expertise to do it that you work with and give specifications as to what you need accomplished. And maybe that .NET contractor gives his expertise with design and programming to accomplish the task.
That's what you need to do, because otherwise, I see failure for you, or very poor to a garbage solution you are going to dump on a company. And they will not be happy about it.
Tuesday, August 26, 2014 1:39 PM
For your kind information Mr.darnold924 as i mentioned above i am new to this and i am an undergraduate student .so, its obvious that i don't have that kind of expertise in programming as my studies don't include programming stuff i am from electrical side.
Tuesday, August 26, 2014 1:46 PM
Ignore the chatter. the code I posted is a simple solution of using two forms. I've posted this code many times before which I developed and other experts have also recommended after seeing my code.
jdweng
Tuesday, August 26, 2014 4:57 PM
Ignore the chatter. the code I posted is a simple solution of using two forms. I've posted this code many times before which I developed and other experts have also recommended after seeing my code.
jdweng
Two different window form APPLICATION.
presumably two exe.
I think you maybe missed that bit.
Hope that helps
Please don't forget to up vote answers you like or which help you and mark one(s) which answer your question.
Thursday, August 28, 2014 8:24 PM
@OP, you need to elaborate farther and in the best of your ability to express the problem to get a serious response.
So far I can't even understand what you're trying to do? so let me ask you several questions.
a) Do you have two complete separated applications where each application lives in its own process? to make it simple and less technical do you have two .exe files, one for each application? and you want them to communicate or exchange information?
b) Do you have two forms that live in the same application and you want them to communicate? again, to make it simple do you have a single .exe file and two forms?
P.S. You can ask as many questions as you would like and we will do our best to help you but to make it happen you can't write few sentences and expect us to figure all the details by ourselves, you need to make things crystal clear.
I agree with darnold924 to some extent, I'd say let the people that its their area of expertise deal with it unless you want to learn software engineering or something of the sort.
Cheers,
Eyal Shilony
You are free to contact me through 'msdn at shilony net' for anything related to the C# forum.
Saturday, August 30, 2014 7:09 PM
I have two complete separated applications where each application lives in its own process and i want them to communicate or exchange information.
Saturday, August 30, 2014 8:03 PM
I've deleted the irrelevant posts here and I'm locking the thread.
@OP, you can create a new thread and continue to discuss your issues there.
Cheers,
Eyal Shilony
You are free to contact me through 'msdn at shilony net' for anything related to the C# forum.