473,385 Members | 1,661 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

communication between two forms

hello
my task is to show only one form at a time.if click
some button in one form the other must be displayed and
viceversa. i try it but i got debugger exception. can u
give me the reason why so.

regards
--rammohan
Nov 15 '05 #1
3 2689
Why not have a controller class that holds references to both forms?
This should work easily and keeps you forms clean:

class SingletonFormController
{
private Form FormA;
private Form FormB;

public void ShowFormA()
{
FormB.Visible = false;
FormA.Visible = true;
}
}

Cheers, Philipp

rammohan wrote:
hello
my task is to show only one form at a time.if click
some button in one form the other must be displayed and
viceversa. i try it but i got debugger exception. can u
give me the reason why so.

regards
--rammohan


Nov 15 '05 #2
He was asking what to do when pressing buttons
and wanting to activate different forms consecutively.

How does your advice answer his query?
Perhaps you might add some more code lines
to show the solution to his problem more clearly ?

"Philipp Sumi" <no****@123456spam.com> wrote in message
news:eB**************@TK2MSFTNGP11.phx.gbl...
Why not have a controller class that holds references to both forms?
This should work easily and keeps you forms clean:

class SingletonFormController
{
private Form FormA;
private Form FormB;

public void ShowFormA()
{
FormB.Visible = false;
FormA.Visible = true;
}
}

Cheers, Philipp

rammohan wrote:
hello
my task is to show only one form at a time.if click
some button in one form the other must be displayed and
viceversa. i try it but i got debugger exception. can u
give me the reason why so.

regards
--rammohan

Nov 15 '05 #3
Vanessa wrote:
He was asking what to do when pressing buttons
and wanting to activate different forms consecutively.
How does your advice answer his query?

private void MyButton_Click(object sender, EventArgs e)
{
SingletonFormController.Instance.ShowFormA();
}

I hope you don't mind that I skipped the class declaration ;-)

Philipp
How does your advice answer his query?
Perhaps you might add some more code lines
to show the solution to his problem more clearly ?

"Philipp Sumi" <no****@123456spam.com> wrote in message
news:eB**************@TK2MSFTNGP11.phx.gbl...
Why not have a controller class that holds references to both forms?
This should work easily and keeps you forms clean:

class SingletonFormController
{
private Form FormA;
private Form FormB;

public void ShowFormA()
{
FormB.Visible = false;
FormA.Visible = true;
}
}

Cheers, Philipp


Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Tim Reynolds | last post by:
I support a .Net application running on a SERVER accessing MF Db2 data. Occasionally, we have some type of connection problem that we have been unable to debug up to this point. We typically...
3
by: pnp | last post by:
Hi all, I want to develop an app that during it's installation it activates itself by making a request to a page online (aspx), than runs a script and provides an activation string for the app....
4
by: Dean L. Howen | last post by:
Please show me advise. My problem is: how to communication between forms? I have 3 forms: The 1st: parent form: is MDI --> I call parentForm The 2nd: child form is called by parentForm...
3
by: Maheshkumar.R | last post by:
Hi groups, How i can command over the MDI CHIlD forms created dynamically at runtime from PARENT. Let say, i have generated 5 mdichild forms, but i want to work with child form1 from MDI...
2
by: Jim Shank | last post by:
I am really trying to find the best OOP way of doing this. I have a parent MDI form with multiple children and I am trying to communicate variables between them. I have been able to successfully...
21
by: dast | last post by:
Hi, I'm having trouble letting my background thread tell my main thread what to do. I'm trying to tell my main thread to open a form, but when my background thread ends, the form that I...
5
by: Mo | last post by:
Hi, I have an application where I read a serial port data from a barcode and set the labels on a form. I also have a textbox and button where you can enter the data and here is the problem. if I...
0
by: zb | last post by:
Here is the page architecture: Page loads multiple user controls (including nested user controls) dynamically based on parameters provided into place holders. Note: The page only has the logic to...
6
by: ecir.hana | last post by:
Hi, let's say I have two scripts: one does some computations and the other one is a graphical front end for launching the first one. And both run in separate processes (front end runs and that it...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.