473,398 Members | 2,120 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,398 software developers and data experts.

Accessing base-form functions from other forms

Hi all,
I need to bring up a form off of my base win form and then,
depending on which button the user clicks, perform a function that is
in my base form. I can create an instance and show the new form fine,
but I am unsure as how to perform function calls from the new form once
it has been shown.
If anyone could point me in the right direction that would be
grand. I have been googling around for about an hour now trying to
figure this out but I have been having a hard time describing my
problem in search terms. Thank you all in advance.

Jul 31 '06 #1
1 1331
This may or may not help you. I've used it to access objects in my
main file (like an eventlog).

Instiate my class in main code section:
public class CSService : System.ServiceProcess.ServiceBase
{
public void Func()
{
Services services = new Services(this);
}
..
..
..
}

This is in another file:
public class Services
{
private CSService Parent;
public Services(CSService f)
{
//
// TODO: Add constructor logic here
//
Parent = f;
}
//So I now have access to my parent (calling) objects
Parent.eventLog1.WriteEntry("wahoooo");
}

Yes it's pretty rough and kind of a quick and dirty method but it does
work. My example was pulled from a service. I hope that helps a
little bit.

Xa*****@gmail.com wrote:
Hi all,
I need to bring up a form off of my base win form and then,
depending on which button the user clicks, perform a function that is
in my base form. I can create an instance and show the new form fine,
but I am unsure as how to perform function calls from the new form once
it has been shown.
If anyone could point me in the right direction that would be
grand. I have been googling around for about an hour now trying to
figure this out but I have been having a hard time describing my
problem in search terms. Thank you all in advance.
Jul 31 '06 #2

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

Similar topics

6
by: Abhijit Deshpande | last post by:
Is there any elegant way to acheive following: class Base { public: Base() {} virtual ~Base() {} virtual void Method() { cout << "Base::Method called"; return; } };
1
by: Bryan Ray | last post by:
I am trying to write an inheritance function, so I can call a base classes method that has been overridden in the derived class. I want to get rid of the ugly 'call()' syntax that would be used....
2
by: Simon White | last post by:
Hi, I have code that looks legal to me and has compiled for years and on latest VC, etc compilers. Just recently gcc made a change to their compiler (3.4) that broke it. I don't have access to...
2
by: Steven T. Hatton | last post by:
I find the surprising. If I derive Rectangle from Point, I can access the members of Point inherited by Rectangle _IF_ they are actually members of a Rectangle. If I have a member of type Point...
4
by: Hadi | last post by:
Hello, Say I have three classes inheritance A <-- B <-- C And in A I have the Create method: class A { public override bool Create() {
5
by: Clive Dixon | last post by:
Is it possible to access an indexer of a base class with identical signature, e.g. class Class1 { public object this { get { // ...
2
by: RKT | last post by:
(Web Developer Express 2005, CSharp, C#) I've searched high and low... If have the typical _Default page. In it is a MultiView that contains another MultiView - in both of those are Views...
5
by: Siva | last post by:
Hello I have a dropdownlist inside the gridview as a template column defined as follows: <asp:TemplateField HeaderText="Choose Location"> <ItemTemplate> <asp:DropDownList ID="ddlChooseLoc"...
3
by: NewToCPP | last post by:
I am trying to access a base class's virtual function from the drived class function. It is complaining that the function is not static. Can anyone tell me what is the problem in the below given...
1
by: nsphelt | last post by:
I am wondering if it is possible to access the underlying property of a base class within a derived that has overridden that property. I am using VB.NET and when I use the MyBase keyword to access...
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: 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
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
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.