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

Want to Acess Same instance of previous form...

2
Hi All.

Rightnow i m stuck C# code!!!

Discription:

1.Main form run.
2.hide Main form and goto form1.
3.form1 to form2.
4.form2 to same instance of form1.
5.Close form2.

I am able to do till steps 3 & step 5.I stuck up at step 4.
Feb 20 '08 #1
4 882
Shashi Sadasivan
1,435 Expert 1GB
Can you create a contructor in form2 which takes a Form Object?
Expand|Select|Wrap|Line Numbers
  1. class form2 : Form
  2. {
  3.    private Form calledByForm
  4.    public form2 (Form prevForm)
  5.    {
  6.       this.calledByForm = prevForm;
  7.    }
  8.  
  9.    private CallPrevForm()
  10.    {
  11.       calledByForm.Show();
  12.    }
  13. }
Feb 20 '08 #2
sid103
2
Thanks Shashi Sadasivan for rly,But still in this i get error on private Form calledByForm and private CallPrevForm().

And I m Bit new to this C# lang,I have used this libs:

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
Feb 20 '08 #3
Shashi Sadasivan
1,435 Expert 1GB
Thanks Shashi Sadasivan for rly,But still in this i get error on private Form calledByForm and private CallPrevForm().
Well, I am not sure how you are generating this error, maybe if you pasted the code from where the error is generating would be a great idea, especially when you consider yourself to be new to this.

What I presume is that you are calling the method and attribute from form 1

If that is the case then when you are instantiating form2 from form1

you should be doing something similar to the foll
Expand|Select|Wrap|Line Numbers
  1. form2 frm2 = new form2(this);
and the method CallPrevForm() is supposed to be called from form2, if you want form1 to call it then make it public
Feb 20 '08 #4
r035198x
13,262 8TB
Hi All.

Rightnow i m stuck C# code!!!

Discription:

1.Main form run.
2.hide Main form and goto form1.
3.form1 to form2.
4.form2 to same instance of form1.
5.Close form2.

I am able to do till steps 3 & step 5.I stuck up at step 4.
This is a common problem posted in this forum. The reason why most people run into this problem unfortunately is poor program design. Forms do not drive a program and should not be the first components of a program. Forms are only one possible input/output platform and should be designed last. Program design should instead be done using objects.
Feb 20 '08 #5

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

Similar topics

1
by: Andy Wells | last post by:
I'm using VB.NET and I have an application that binds a schema to the main form's controls, and the user has the ability to load an XML file through the schema and into the bound form. My...
3
by: Taji | last post by:
Can someone please explain this to me. When I run the following query in MS Access, it doesn't return anything. SELECT tbl_vdc.vcd_id, tbl_vdc.vcd_count, tbl_vdc.batch_day FROM tbl_vdc WHERE...
4
by: jen | last post by:
Hello, I'm just starting to develop an Access database. I have a start form and the user can click a different button to open different forms. I'm trying to modify the code so when the user...
1
by: Don | last post by:
I'm getting the following exception displayed in the task list at design time for my project: "Code generation for property 'Controls' failed. Error was: 'Object reference not set to an...
1
by: Victory | last post by:
i am using the Shown event for a form. It is in .NET 2.0. It is an event that occurs when a form is displayed. I wanted to use this event since i needed the processing of data to occur after the...
3
by: ivanerz | last post by:
I am at a loss How do i load a vb data grid that is on a web form with data from an MS Acess table? Please forgive me if this is posted to the wrong forum.
1
by: lokeshreddy16 | last post by:
'this is my code plz guys help how to save data from vb 2005 and other this that i am able to view the data from acess but i am not able save to acess i dont whether my code for save is correct of...
1
by: Lynda Attram | last post by:
Am creating a search engine for an acess database and am having problems in giving some codes right,eg is how to give a right code for on click event on the form.i really need your help.
1
by: jack turner | last post by:
I'm currently creating a database for a travel agency firm in Acess 2003. I'd like to know how I can create a combo box where I select the "holiday Number" and the "holiday destination" and "holiday...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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...
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
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...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.