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

open a form generically from a string (name of form)

Hi

I have several different types of form
e.g.
- custmaster
- prodmaster
- invoice

all inherited from different form types

How can I open any form generically
if I have the form name given as a string
(at runtime)

How can I trap an error In case the string does
not represent a form name or is of an abstract form type

Regards
Sanjay Minni
www.assetage.com

Nov 17 '05 #1
3 1693
Sanjay,
You can use switch statement for string given, so you can capture a wrong
string .
Best regards,
Vuong
Tran Xuan
"Sanjay Minni" <sm*********@minisoftindia.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
Hi

I have several different types of form
e.g.
- custmaster
- prodmaster
- invoice

all inherited from different form types

How can I open any form generically
if I have the form name given as a string
(at runtime)

How can I trap an error In case the string does
not represent a form name or is of an abstract form type

Regards
Sanjay Minni
www.assetage.com

Nov 17 '05 #2
1-read string and call 'Type ty=Type.GetType("className,AssemblyName");
2-check if type is not null
3-call Form f=(Form)Activator.CreateInstance(ty,constructor parameters);
4-call f.Show()

Dincer Uyav

"Sanjay Minni" wrote:
Hi

I have several different types of form
e.g.
- custmaster
- prodmaster
- invoice

all inherited from different form types

How can I open any form generically
if I have the form name given as a string
(at runtime)

How can I trap an error In case the string does
not represent a form name or is of an abstract form type

Regards
Sanjay Minni
www.assetage.com

Nov 17 '05 #3
Hi,

Are those the name of the types(classes) ?
If so and they are declared in the same assembly you can use CreateInstance

Or just use a switch statement as suggested by the other opster.
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Sanjay Minni" <sm*********@minisoftindia.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
Hi

I have several different types of form
e.g.
- custmaster
- prodmaster
- invoice

all inherited from different form types

How can I open any form generically
if I have the form name given as a string
(at runtime)

How can I trap an error In case the string does
not represent a form name or is of an abstract form type

Regards
Sanjay Minni
www.assetage.com

Nov 17 '05 #4

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

Similar topics

4
by: Andras Gilicz | last post by:
Hi VB fans I'm working on a relatively large project in VB6 with about a dozen forms, including graphs, labels, text boxes, etc. The software itself is actually a flow simulator with more or...
3
by: Andy Davis | last post by:
How do i or can I open a word document directly from Access? I would like to be able for the user to click a button on my form to open a word document and then also run a macro in Word. Thanks...
6
by: lauren quantrell | last post by:
I have a command button on a continuous subform and I want the user to click it to open a small popup form that opens in the position of the mouse (which is the same as the position of the command...
4
by: sara | last post by:
I am learning with a simple application/form. I am ok - enter customer name, list box of customers, select a customer, see the items for that customer. The items form has customer ID and Name...
13
by: Daniel Walzenbach | last post by:
Hi, Imagine the following situation: I have an asp.net application which allows uploading files to a SQL Server 2000 database (Files are stored as type "images"). As a next step I would like to...
4
by: Bugs | last post by:
Hi, I wonder if anyone can help me out. I'm building a vb.net application that has a form with a panel that contains several other sub forms (as a collection of controls). What I'm wanting to...
11
by: shankwheat | last post by:
I have a function which passes text from txtdebt to debtsbox which works fine. However, I want to add code which examines the value of debtsbox and if any of the values the user entered contain the...
13
by: robert.waters | last post by:
Do you have your users rely on the windows taskbar to manage/navigate between the forms they have open, or do you provide another (more robust) method? Does anyone use a custom navigation system...
14
by: SimeonD | last post by:
Hi I have an access database called Sales.Mdb In vb.net 2005, I'd like to open it. Which I can do. What I can't figure out is how to figure out if Sales.Mdb is open already. If so, I want to open...
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: 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...
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?
0
marktang
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,...
0
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...
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
jinu1996
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...
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...

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.