using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
// START of Form1.cs object =======================================================
namespace PtrExample
{
public partial class Form1 : Form
{
doWork MyDoWorkClass = new doWork();
public Form1()
{
// allow class instance object to "point back and call methods in this "parent" object
MyDoWorkClass.PointerToParent = this;
InitializeComponent();
}
public void ExecuteClassRequest()
{
MessageBox.Show("I'M HERE", "NOTICE:");
}
}
}
// ========================================================================================
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
// START of doWork.cs object =======================================================
namespace PtrExample
{
class doWork
{
private object mPointerToParent;
// property
public object PointerToParent
{
// get { return mPointerToParent; }
set { mPointerToParent = value; }
}
// method
private void CallMethodInParent
{
// Would like to call method in "parent" that created this class!!!!!!!!
// FAILS HERE
mPointerToParent.ExecuteClassRequest();
}
}
}
// ========================================================================================
ASKER
The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.
TRUSTED BY