Hi, I have a question about instantiating forms.
I have a particular issue where I must load a form, but the name of the form
is held in a variable (our app uses differently laid out forms for different
sites, so the name of the form to load is held in a resource.
If VB6, I did the following:
Dim lForm As Form
Set lForm = Forms.Add(pFormName)
lForm.Show
pFormName is a string variable holding the actual name of the form. This
allows me to add an instance the form to the forms collection and then
handle it as any other form.
As the Forms collection is dead & gone in .NET, how would I achieve the same
result?
Thanks
Lorne 5 817
Check out Assembly.Creatinstance in the docs.. that should do what your
looking for.
along the lines of
x as form = [Assembly].GetExecutingAssembly.CreateInstance("FormName")
"Lorne Smith" <no@spam.here> wrote in message
news:ep**************@TK2MSFTNGP09.phx.gbl... Hi, I have a question about instantiating forms.
I have a particular issue where I must load a form, but the name of the
form is held in a variable (our app uses differently laid out forms for
different sites, so the name of the form to load is held in a resource.
If VB6, I did the following:
Dim lForm As Form
Set lForm = Forms.Add(pFormName) lForm.Show
pFormName is a string variable holding the actual name of the form. This allows me to add an instance the form to the forms collection and then handle it as any other form.
As the Forms collection is dead & gone in .NET, how would I achieve the
same result?
Thanks
Lorne
Thanks loads :) I'll give it a try!
Lorne
"Rigga" <s@g.c> wrote in message
news:xU******************@wards.force9.net... Check out Assembly.Creatinstance in the docs.. that should do what your looking for.
along the lines of x as form = [Assembly].GetExecutingAssembly.CreateInstance("FormName")
"Lorne Smith" <no@spam.here> wrote in message news:ep**************@TK2MSFTNGP09.phx.gbl... Hi, I have a question about instantiating forms.
I have a particular issue where I must load a form, but the name of the form is held in a variable (our app uses differently laid out forms for different sites, so the name of the form to load is held in a resource.
If VB6, I did the following:
Dim lForm As Form
Set lForm = Forms.Add(pFormName) lForm.Show
pFormName is a string variable holding the actual name of the form.
This allows me to add an instance the form to the forms collection and then handle it as any other form.
As the Forms collection is dead & gone in .NET, how would I achieve the same result?
Thanks
Lorne
"Lorne Smith" <no@spam.here> schrieb Hi, I have a question about instantiating forms.
I have a particular issue where I must load a form, but the name of the form is held in a variable (our app uses differently laid out forms for different sites, so the name of the form to load is held in a resource.
If VB6, I did the following:
Dim lForm As Form
Set lForm = Forms.Add(pFormName) lForm.Show
pFormName is a string variable holding the actual name of the form. This allows me to add an instance the form to the forms collection and then handle it as any other form.
As the Forms collection is dead & gone in .NET, how would I achieve the same result?
System.Activator.CreateInstance
See also: http://msdn.microsoft.com/library/en...usingtypes.asp
--
Armin http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
"Armin Zingler" <az*******@freenet.de> wrote in message
news:e7**************@TK2MSFTNGP12.phx.gbl... "Lorne Smith" <no@spam.here> schrieb Hi, I have a question about instantiating forms.
I have a particular issue where I must load a form, but the name of the form is held in a variable (our app uses differently laid out forms for different sites, so the name of the form to load is held in a resource.
If VB6, I did the following:
Dim lForm As Form
Set lForm = Forms.Add(pFormName) lForm.Show
pFormName is a string variable holding the actual name of the form. This allows me to add an instance the form to the forms collection and then handle it as any other form.
As the Forms collection is dead & gone in .NET, how would I achieve the same result?
System.Activator.CreateInstance
See also: http://msdn.microsoft.com/library/en...micallyloading
usingtypes.asp
-- Armin
http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
Thanks Armin, Rigga has also pointed me in that direction :)
I *knew* it was doable :)
Lorne
Hi Armin,
Will you look at that form question from Stan Sainte Rose?
It is something special with a MDI and you know that I never use that.
He did not start it as a MDI question otherwise I would not have answered
it.
And more, it sound as something strange.
Cor This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
by: Richard Cornford |
last post by:
I am interested in hearing opinions on the semantic meaning of FORM
(elements) in HTML.
I have to start of apologising because this question arose in a context
that is not applicable to the...
|
by: Targa |
last post by:
Trying to total some price fields in a form but doesnt work when all the
referenced form fields dont exisit.
This is for an invoice - pulled prom a database and the form doesnt always
contain the...
|
by: Lyn |
last post by:
Hi,
I am working on a genealogy form. The only table (so far) lists everybody
in the family, one record per person. Each record has an autonum ID.
The parent form (frmMainForm) displays the...
|
by: Raposa Velha |
last post by:
Hello to all!
Does any of you want to comment the approach I implement for
instantiating a form? A description and an example follow.
Cheers,
RV
jmclopesAThotmail.com replace the AT with the...
|
by: Jozef |
last post by:
I have some old code that I use from the Access 95 Developers handbook. The
code works very well, with the exception that it doesn't seem to recognize
wide screens, and sizes tab controls so that...
|
by: RAJ |
last post by:
hi
plz tell me how to know "how window is going to close"...
i have to right code for X button of forms...
plz telll me
thanks
bye
|
by: Gary Miller |
last post by:
Does anyone know how to detect a modeless form on closing by the form that
invoked the modeless form?
form.Show();
|
by: Alex Sibilev |
last post by:
Hello,
I have a really weird problem I've been trying to solve it without any luck
for the last couple of hours :(
I'm writing a "conference board" application (quite similar to ASP.NET...
|
by: ortaias |
last post by:
I have a form which calls up a second form for purposes of data entry.
When closing the data entry form and returning to the main form, things
don't work as expected.
When I return to the main...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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...
|
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,...
|
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...
|
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...
|
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,...
| |