473,808 Members | 2,885 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1351
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.ServiceP rocess.ServiceB ase
{
public void Func()
{
Services services = new Services(this);
}
..
..
..
}

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

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.c om 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
5643
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
1742
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. Ideally I would like to call the method using syntax such as: object.base.method() The idea is to use an object ('base') to provide the base classes properties and proxy methods to the real methods stored in '_class' - see the function below....
2
1699
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 the C++ standard but information we do have access to uptill now suggests that this shouldn't be a problem. A code example is this: template<class T> class Base
2
2315
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 in Rectangle, the compiler tells me Point::x is protected. I would have expected Rectangle to see the protected members of any Point. Compiling the following code give me this error: g++ -o rectangle main.cc main.cc: In member function `size_t...
4
1683
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
2300
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
1484
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 containing my specialized UserControls. In any of those views, I need to acess the _Default page (parent, several times removed). I would like a strongly typed mechanism, but at this point,
5
2770
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" runat="server"> </asp:DropDownList> </ItemTemplate> </asp:TemplateField> I have the gridview inside of a master page- content hierarchy.
3
2225
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 program. class Base { private: unsigned short abc; public:
1
1511
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 the property of the base class, it accesses the overridden property instead. Specifically, my class is inheriting the TextBox class and I am overriding the Text property to have it display something different based on the state of my class. I was...
0
9721
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10631
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10374
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10374
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10114
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7651
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6880
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4331
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3859
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.