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

Function calls across forms

Hi, I am very new to C#, so this may seem to simple to be
true. Anyway, the problem is this: I have my MainWindow
class and an MDI child window and its associated class.
The class MainWindow class has a function called
DrawChart. My MDI child needs to make a call to DrawChart.

Now I know I can say something along the lines of...

MainWindow xxx = new MainWindow ();
xxx.DrawChart ();

The problem here is I have a counter in the MainWindow
class, which gets reset every time a call to new
MainWindow (); is made. How do I call this function from
my MDI child window and keep the existing values inside
the MainWindow class?

Thanks in advance,
Shaun Pudwell.
Nov 15 '05 #1
1 1260
Shaun, you need to keep a reference to your original MainWindow object. You
could do this by passing the object around or by creating a class level
variable and storing the reference there. If you want to call MainWindow
from your other form make sure to pass a reference to the other form
pointing to your original MainWindow object.

--
Greg Ewing [MVP]
http://www.citidc.com

"Shaun Pudwell" <sh***********@tiscali.co.uk> wrote in message
news:19****************************@phx.gbl...
Hi, I am very new to C#, so this may seem to simple to be
true. Anyway, the problem is this: I have my MainWindow
class and an MDI child window and its associated class.
The class MainWindow class has a function called
DrawChart. My MDI child needs to make a call to DrawChart.

Now I know I can say something along the lines of...

MainWindow xxx = new MainWindow ();
xxx.DrawChart ();

The problem here is I have a counter in the MainWindow
class, which gets reset every time a call to new
MainWindow (); is made. How do I call this function from
my MDI child window and keep the existing values inside
the MainWindow class?

Thanks in advance,
Shaun Pudwell.

Nov 15 '05 #2

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

Similar topics

6
by: Andrew | last post by:
I keep getting a runtime error stating that this document.adddealer.dealertoadd.value = dealer; is null or not an object. I've rewritten the Function everyway I could think of, and couldn't find...
3
by: Richard Hollenbeck | last post by:
Back in the old days before I started learning about menubars (the day before yesterday,) I based all my operations on command buttons on the forms. Now the forms are all cluttered up with buttons...
3
by: Stephen Sprunk | last post by:
On a project I'm working on, I ran across the following macros: /* assume s is struct stream *, s->p is char, v is unit16_t or uint32_t */ #define in_uint16_le(s,v) { v = *((s)->p++); v +=...
6
by: RandomElle | last post by:
Hi there I'm hoping someone can help me out with the use of the Eval function. I am using Access2003 under WinXP Pro. I can successfully use the Eval function and get it to call any function with...
13
by: Andrew Falanga | last post by:
HI, Just a warning, I'm a javascript neophyte. I'm writing a function to validate the contents of a form on a web page I'm developing. Since I'm a neophyte, this function is quite simple at...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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...

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.