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

Form, form, another form

Form.Owner and Form.Parent, what's the difference between them?

Form.ShowDialog() and Form.Show(), when to use which?

Form.Activated(), what does it mean when saying a Form is "activated"?

Thanks!

Nov 15 '05 #1
3 7506
The MSDN library contains a lot of information on those properties and
methods. Here is a quick synopsis:

- Form.Owner is a form that 'owns' this form. When the owner is minimized
or restored, so is this form.

- Form.Parent comes from the fact that a Form is also a control. Every
control can have one parent which is the control with this control inside
it. Usually for a form, this is null.

- Form.ShowDialog() displays the form as a dialog, which means it is stays
on top of the program and code execution stops on the line till the form's
DialogResult property is set (and then is returned).

- Form.Show() simply displays the form normally.

- Form.Activated() brings the form to the top of the screen and gives the
form focus.

Best way to learn more about these is to try them out. Hope this helps.

Cheers,

-Noah Coad
Microsoft MCP & MVP
"fh1996" <fh****@yahoo.com> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
Form.Owner and Form.Parent, what's the difference between them?

Form.ShowDialog() and Form.Show(), when to use which?

Form.Activated(), what does it mean when saying a Form is "activated"?

Thanks!


Nov 15 '05 #2
Noah Coad [MCP & MVP] <no**@coad.net> wrote in message
news:#z**************@TK2MSFTNGP11.phx.gbl...
The MSDN library contains a lot of information on those properties and
methods. Here is a quick synopsis:

- Form.Owner is a form that 'owns' this form. When the owner is minimized
or restored, so is this form.

- Form.Parent comes from the fact that a Form is also a control. Every
control can have one parent which is the control with this control inside
it. Usually for a form, this is null.

- Form.ShowDialog() displays the form as a dialog, which means it is stays
on top of the program and code execution stops on the line till the form's
DialogResult property is set (and then is returned).

- Form.Show() simply displays the form normally.

- Form.Activated() brings the form to the top of the screen and gives the
form focus.

Best way to learn more about these is to try them out. Hope this helps.

Cheers,

-Noah Coad
Microsoft MCP & MVP


Thanks!

If in a button's click method of FormA, FormB is craeted:

FormB f = new FormB();
f.ShowDialog();

Then, what's the relatioship between FormA and FormB?
Nov 15 '05 #3
Sam
In this example, none.

However the usual method of calling ShowDialog is as
follows...

FormB f = new FormB();
f.ShowDialog(this);

In this case FormB.Owner will equal FormA

As mentioned previously, .Parent is almost always null
unless the form is embedded within another control (which
is possible)

Sam
-----Original Message-----

If in a button's click method of FormA, FormB is craeted:

FormB f = new FormB();
f.ShowDialog();

Then, what's the relatioship between FormA and FormB?
.

Nov 15 '05 #4

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

Similar topics

13
by: genetic.error | last post by:
I'm moving from Vb6 to VB.Net. I have a feeling this has come up before... The VS.Net MSDN file seems to state that the following should work: Form1.Show Form1.Visible = True Form1.Hide...
1
by: mhawkins19 | last post by:
I have a form built and on the onclick event I validate all of the fields and then if the form is ok, on the submit event I run a javascript function to set a cookie and download a file from the...
10
by: iam247 | last post by:
Hi In my prototype asp page (with no javascript and no password validation, I have a registration form with the following action: <form name="form" method="post" action="RegDetails.asp"> ...
5
by: ChrisR | last post by:
Hi all Ive have a Main Form with Command Buttons down the Left hand side, that open various forms. Clicking on a button opens a Sub Form which is moved to take up 3/4s of the right of the main...
15
by: http://www.visual-basic-data-mining.net/forum | last post by:
Does anyone have any idea how to transferring data from TextBox1 in form1 to textBox2 in form2..... That means after i fill in any data in textBox1 and click Next button... It will bring me to...
21
by: Just Me | last post by:
I've tried in a few places using a variable name Form and it appears to be OK. For example: Public Shared Sub WritePositionsInRegistry(ByVal Form As Form, ByVal SubkeyName As String) Is it OK...
4
by: Bremanand | last post by:
Hi..Am doing Retailer software using VB 6.0 with ms-access.. Actually i have many form(sales entry form,purchase entry form ,stock form, etc..) in my project which all are in MDI except Log in...
3
by: kate2272 | last post by:
Hi Guys I was wondering if it is possible to turn AllowEdits to false after data has been entered for individual fields within a form/sub-form. I've found that I can do this in the 'AfterUpDate'...
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
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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...
1
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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.