How does a "sub-form", i.e. one invoked by another form, determine anything
about the form which brought it into existence, i.e., I suppose,
instantiated it? I wanted to so something like this ...
MsgBox("called by " & Owner.Name)
.... but that throws a null reference exception. Parent.Name and
ParentForm.Name also throw null reference exceptions. Form1.Name works -
but that's not very flexible.
My MsgBox, above, is in the constructor of the "sub-form".
Thanks, Bob 3 1901
On Sep 18, 2:15*pm, "eBob.com" <eBob....@total lybogus.comwrot e:
How does a "sub-form", i.e. one invoked by another form, determine anything
about the form which brought it into existence, i.e., I suppose,
instantiated it? *I wanted to so something like this ...
MsgBox("called by " & Owner.Name)
... but that throws a null reference exception. *Parent.Name and
ParentForm.Name also throw null reference exceptions. *Form1.Name works-
but that's not very flexible.
My MsgBox, above, is in the constructor of the "sub-form".
Thanks, *Bob
If you want to show the message box from the constructor, you're most
likely going to need to pass in a reference to the creating from as a
parameter.
I wonder however if you mean you want to know what form showed the
"sub-form". In which case the message box should live in the "Show"
and "ShowDialog " method, but be warned it might only work if you use
the overloaded call that passes in the owning form.
Thanks,
Seth Rowe [MVP] http://sethrowe.blogspot.com/
If it is an MdiChild, the it can call MdiParent.Name. If as you suggest you
are just doing a ShowDialog type of call, then you could use a StackTrace
object.
"eBob.com" <eB******@total lybogus.comwrot e in message
news:uB******** ******@TK2MSFTN GP05.phx.gbl...
How does a "sub-form", i.e. one invoked by another form, determine
anything about the form which brought it into existence, i.e., I suppose,
instantiated it? I wanted to so something like this ...
MsgBox("called by " & Owner.Name)
... but that throws a null reference exception. Parent.Name and
ParentForm.Name also throw null reference exceptions. Form1.Name works -
but that's not very flexible.
My MsgBox, above, is in the constructor of the "sub-form".
Thanks, Bob
>"rowe_newsgrou ps" <ro********@yah oo.comwrote in message news:95******* *************** ************@m4 5g2000hsb.googl egroups.com... On Sep 18, 2:15 pm, "eBob.com" <eBob....@total lybogus.comwrot e:
>How does a "sub-form", i.e. one invoked by another form, determine anything about the form which brought it into existence, i.e., I suppose, instantiated it? I wanted to so something like this ...
MsgBox("call ed by " & Owner.Name)
... but that throws a null reference exception. Parent.Name and ParentForm.Nam e also throw null reference exceptions. Form1.Name works - but that's not very flexible.
My MsgBox, above, is in the constructor of the "sub-form".
Thanks, Bob
If you want to show the message box from the constructor, you're most likely going to need to pass in a reference to the creating from as a parameter.
I wonder however if you mean you want to know what form showed the "sub-form". In which case the message box should live in the "Show" and "ShowDialog " method, but be warned it might only work if you use the overloaded call that passes in the owning form.
Thanks,
Seth Rowe [MVP] http://sethrowe.blogspot.com/
Hi Seth,
What I am after is the name of the form which did the
Dim sform as new SomeForm
i.e. in SomeForm code I want to get the name of who New'ed me. Maybe the
same code will Show me maybe it won't. Maybe it already has maybe it never
will.
Although I ran into the problem in constructor code it seems to me that it
is a general problem. MsgBox has nothing to do with the problem, I was just
using it to experiment and to illustrate the problem. In general I would
say that it is a bad programming practice to try to get at any information
about your creator (unless it is explicitly passed). But I think that there
might be exceptions such as Location (which is what I was after).
What really makes me curious is what Parent, ParentForm, and Owner mean
since not a one of them means what I would have guessed.
Thanks, Bob This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: TG |
last post by:
I have a validation form that must behave differently based on the results
of a PHP validation check. I have a post command at the top of my form that
calls itself. I don't leave the form when performing the validation check on
the values that were entered into the form, I simply repost the form to
perform the PHP validation. If any of the values that have been entered into
the form are incorrect, I display a warning message on the screen...
|
by: TG |
last post by:
Dear PHP Group,
I have two forms that are used to collect user information. The first one
takes user inputted values such as fullname, city, address etc. I want these
values to display in the second form when it is called. Both forms are .htm
files that call themselves when the submit button is press via the following
command in each form:
<form method="post" action="<?php $server?>">
|
by: Pete..... |
last post by:
Hi all.
I have made a webpage where there is a webform where people can fill in
their personel information:
The code is below:
I want to transfer the data to a postgreSQL database ( I have allready made
the database with the neccesary tables, and I know how to connect to it )
but I really have no idea how I can transfer the data from the webform to
|
by: John |
last post by:
Dear all,
It been more than 3 days I am trying to debug this program, I
interpret it using activePerl and it is giving (perl -wc
code_process.pl) no error syntax but when I put it online, change to
the appropriate mode and test the html form it gave me an 500 internel
server error.
I really need it to be done soon, I would not post here before I test
it as much as I can,
|
by: Andrew Williams |
last post by:
Does anyone know of a way to quickly validate an HTML web
form? I need to make sure that certain fields on my form
actually contain data and are not submitted blank.
I have tried using client-side Javascript validation which
flags up when a field is empty but the form is still
submitted.
Here is the ASP code I am using to submit the form to an e-
mail with CDONTS:
| |
by: bart plessers |
last post by:
Hello,
I have a form with some checkboxes, i.e.
The default value of this checkbox is determined in a global file
(config.asp), that is included in first line of the form, i.e.
ShowFilenames = 1
The first time the form is displayed, the value of ShowFilenames should be
|
by: David Cairns |
last post by:
Hi
can anyone help me i am new to asp and going mad, why would the
following only display the last line in the email, i.e the history
text.
thanks David Cairns
<%@ Language=VBScript %>
<%
|
by: Nick |
last post by:
Loop to create an array from a dynamic form.
I'm having trouble with an application, and I'll try to explain it as
clearly as possible:
1. I have a form with two fields, say Apples and Oranges. The user
selects from a drop down menu, between 1-10 of each and clicks submit.
The resulting page will display a NEW form, with rows and a list of
fields for the amount of each items selected.
|
by: Citoyen du Monde |
last post by:
Trying to get some ideas on a simple javascript project (to teach myself the
language).
I want to develop a client-side vocabulary practice application that would
allow users to
enter their own words, their own definitions plus an example of how the word
is
used in practice. It'll be all client side with - cookies? to get
persistence so that the words won't
disappear on me each time the page is closed (which is what happened when I
|
by: CJ |
last post by:
Why won't this work?
I am passing the name of the form (I have two that use this validation
script) but I keep getting an error.
Error reads: "document.which_form.name is null or not an object"
HTML-----------
Form is ----> <form action="thanks.php" method="post" name="contact_form"
id="contact_form">
Name -------> <input type="text" name="name" id="name" size="25">
Button sends code -----> <input type="button" value="Submit Form"
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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...
|
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...
|
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,...
|
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...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |