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

Referencing the owner of a form

Hi all,

I have a an instance of a form, lets say Form2, that is constructed
from within a event handler of an instance of Form1, subsequently I
call ShowDialog with the instance of Form1 as its owner:

form2 = gcnew Form2();
form2->ShowDialog(this);

Form1 is constructed within main through generated code by VS2005:

int main(array<System::String ^^args)
{
// Enabling Windows XP visual effects before any controls are created
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(fal se);

// Create the main window and run it
Application::Run(gcnew Form1());
return 0;
}

Now, when I try to reference the public members (e.g. dataAdapter) of
the instance of Form1 from the instance of Form2 (form2), I receive the
following error:

'dataAdapter' : is not a member of 'System::Windows::Forms::Form'

Can anybody help me out with this? How can I reference the instance of
Form1 that is constructed in main from within form2?

Thank in advance

Maart

Oct 24 '06 #1
1 1154
'Fixed' it

I had to cast back the owner:

Form1^ f1 = (Form1^) this->Owner;

Subsequently its members were available.

Maart

Oct 24 '06 #2

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

Similar topics

6
by: jstaggs39 | last post by:
I want to create a Dcount and an If...Then...Else statement to count the number of records in a table based on the date that is entered to run the form. The If....Else statment comes in because if...
2
by: Bruce D | last post by:
I have a form that opens up with my application. It acts as the main menu. Let's just say it looks like this: Public Class frmStartup ' some other settings Public UserID As Integer = 0 ' a...
12
by: Tom W | last post by:
What's the difference in these three?
2
by: dan heskett | last post by:
I am owner-drawing a listbox, in an attempt to create a nice list with some custom "fields" and text layout. Essentially it works, but I must be missing something big, conceptually, because I...
3
by: Don | last post by:
If you have a form that calls another form via the following code: Dim myForm as Form2 myForm = New Form2 myForm.Owner = Me MyForm.ShowDialog and you minimize the second form, the first form...
3
by: Jeff Calico | last post by:
Hi I have what I think is a easy question about how to pull cross reference data when I transform my XML file. I can't seem to find a good example of how to do this on the web, though. Here...
0
by: Polanski24 | last post by:
Hello! It was simple in .NET 1.1 public void SetOwner(Form owner) { if (this.InvokeRequired) { this.Invoke( new OwnerSetDelegate(this.SetOwner), new object { owner });
0
by: Brian Henry | last post by:
I cant seem to remember this one... I have a list view, and im owner drawing the items, i dont want the selection to hide when it loses focus so i have hideselection = false, but when i owner draw...
4
by: normb | last post by:
My name is Norm, I changed something that caused this problem, and I do not what it was. I also do not know how to debug this problem! The line where the crash occures is marked by an *. The...
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
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?
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
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,...

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.