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

Set visibility on parent form from child.

Hi

I'm having trouble setting the main form visible from within the child form. I have set the main form to hide (SignatureMain.Hide())

I then load the child form from within a button on form1

Treatment.ShowDialog()

On the child form Treatment i try to do the following in an Exit button

this.ParentForm.Visible = true
this.Close()

What i'm gettign is the following

An unhandled exception of type 'System.NullReferenceException' occurred in Signature.ex

Additional information: Object reference not set to an instance of an object

NOTE

I have even set the parent form as follows

Treatment.ShowDialog(this)

This is suppose to set the this (SignatureMain) as the parent to Treatment

When i run the debbugger and look at ParentForm, its null??

Thanks
Jul 21 '05 #1
1 2088
Ok i have figured out the solution. Here it is for anyone looking for the information later

When loading a form using: myForm.ShowDialog(this) were "this" is the OWNER of the form you are loading, you need to use in the child form the following to get to its properties

this.Owner.Visible = true; <-- "this" is the child form and i'm accessing the visible property of the parent form (owner)

I'm still not clear as to why Parent and or ParentForm did nto work so if anyone has the answer to that one please post

Enjoy!
Jul 21 '05 #2

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

Similar topics

25
by: Steve Jorgensen | last post by:
Yup, Steve's full of tips, but hey, it makes him feel important, right? Ok, here goes. I've been trying to improve encapsulation by putting code in the same object as the stuff it affects, so I...
3
by: Maheshkumar.R | last post by:
Hi groups, How i can command over the MDI CHIlD forms created dynamically at runtime from PARENT. Let say, i have generated 5 mdichild forms, but i want to work with child form1 from MDI...
1
by: Earl Teigrob | last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at...
2
by: Jim Shank | last post by:
I am really trying to find the best OOP way of doing this. I have a parent MDI form with multiple children and I am trying to communicate variables between them. I have been able to successfully...
10
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the...
1
by: POnfri | last post by:
Hi I'm having trouble setting the main form visible from within the child form. I have set the main form to hide (SignatureMain.Hide()) I then load the child form from within a button on form1...
3
by: Eddie | last post by:
If FormMain = MDI parent, FormSub = Child parent, I execute FormSub from the menu like this way. FormSub^ sub = gcnew FormSub; sub->MdiParent = this; sub->Show(); This can generate child...
4
by: Richard Lewis Haggard | last post by:
What is the mechanism by which a child window can notify its parent that it has been clicked on? -- Richard Lewis Haggard www.Haggard-And-Associates.com
1
by: cleancode | last post by:
Suppose I have a Parent DIV element and I dynamically add DIV's inside it (Children) using appendChild. It works . But if I were to now set the visibility of the Parent DIV to Invisible, although...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.