473,394 Members | 1,761 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,394 software developers and data experts.

3 forms and 3 buttons - to go to each form

107 100+
Hello,
I have created a windows application w/3 forms and one button on each form.
I first want to be able to say click button on form1 and get to form2 and have form1 hide.
I thought this code would work
Form2 newWindow = new Form2();
newWindow.Show();
this.hide();
And actually it does work to get me to form 2- but then I thought I could modify code to go from form2 to form3 and then form3 to form1.
But it doesn't-
can you help
thank you
Jun 5 '09 #1
4 2510
tlhintoq
3,525 Expert 2GB
The primary problem with your logic is that not every form knows of every other form.

1 makes a new 2
2 makes a new 3
3 has no knowledge of the original 1, so how can it reference it?

I'll give you a fast "cheat" way so you can keep working/learning.

In your Program.cs file...
Expand|Select|Wrap|Line Numbers
  1. public static Form1 Tommy = new Form1();
  2. public static Form2 Billy = new Form2();
  3. public static Form3 Mary = new Form3();
  4.  
Now all of your forms have a common point of creation, and the Program.CS file ties them all together with a common point of reference.

Your instance of form2 (Named Billy) can always call your instance of form3 Program.Mary.Hide(); for example.
Jun 5 '09 #2
buddyr
107 100+
thanks for help and code -
Jun 5 '09 #3
r035198x
13,262 8TB
Better stop hacking at your keyboard and cheating your way into programming. You will only program yourself into a corner that way. Read reply #7 in this thread.
Jun 8 '09 #4
buddyr
107 100+
thank you for knowledge- I was a professional musician for years- and I realized some of the things I learned wrong young- later were problems when I was trying to play on a professonal level.
Jun 8 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: KK | last post by:
Windows Forms Inheritance, Incomplete? I was playing around with Windows Forms and found out this Forms Inheritance feature. The moment I saw that, I felt this can be used effectively if the...
2
by: KK | last post by:
** Posting it here cause after couple of days no body responded.** I was playing around with Windows Forms and found out this Forms Inheritance feature. The moment I saw that, I felt this can...
6
by: MX1 | last post by:
Hi, I've created a series of navigation buttons to be used as a standard across many forms in an Access DB. Does anyone know an easy way to cut and paste these navigation buttons into each new...
6
by: Patrick Coghlan | last post by:
I want to create about 4 forms with the same dimensions and background colours, similar to the forms one has to traverse when installing various software packages. I'm using Visual Studio and...
5
by: dominique | last post by:
Hi, I want to write code to manage standard (or generic) forms in Windows Forms (i don't know the correct word) like that : - a base form in a class : frmBase with some controls inside it :...
4
by: Duncan Gordon | last post by:
I am having some difficulty in making a form of greater size than the screen resolution. I have researched the matter and it seems that creating forms that are larger is simply not possible. I am...
3
by: Simon Verona | last post by:
I have a parent form which contains a toolbar. The toolbar controls the loading and switching to of MDI child forms. The code for the toolbar click event and one of the subroutines that loads...
25
by: PhilBowen | last post by:
I am using Access 2003. I want to synchronise sub forms via buttons shown on the main form. The main form provides information for each application that is received. The sub forms accessed via...
5
by: c676228 | last post by:
Hi everyone, my colleagues are thinking about have three insurance plans on one asp page: I simplify the plan as follow: text box:number of people plan1 plan2 plan3
6
by: Zetten | last post by:
This is going to be a long one, but hopefully that will make it easier to understand. I know I don't like posts with too little detail when I'm searching for help. I am creating a form with which...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.