471,337 Members | 907 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

Access a form, using a string literal?

We have a question but we're in doubt if it's even possible or not.

The question is as follows:

Is it possible to access a form using a string literal, and if so yes?

We want to use something like this (don't mind the syntax as it obviously
doesn't work):

Form("Form1") frm = ("Form1")GetForm("Form1");

So we're able to access all the properties and methods of Form1 and not
just the methods and properties of the base class "Form".

Any help on this one is greatly appreciated!

Gerrit
Jan 26 '06 #1
3 1540
I would think you could try Reflection, for example, see
http://www.dotnetbips.com/articles/d...cle.aspx?id=35

but obviouly, you will lose the benefits of static type checking, code will
be hard to debug and the performance may even suffer

Anything else close will be something like dynamic identifiers in the
just-released VB 9 Linq CTP

"Gerrit Snel" wrote:
We have a question but we're in doubt if it's even possible or not.

The question is as follows:

Is it possible to access a form using a string literal, and if so yes?

We want to use something like this (don't mind the syntax as it obviously
doesn't work):

Form("Form1") frm = ("Form1")GetForm("Form1");

So we're able to access all the properties and methods of Form1 and not
just the methods and properties of the base class "Form".

Any help on this one is greatly appreciated!

Gerrit

Jan 26 '06 #2
Nothing like that will really work. I assume you are talking about running
code typed at runtime or something.
At design time you could just do:

Form1 frm = new Form1

That would give you access to all the properties and methods.

HTH

Ciaran
"Gerrit Snel" <gs*************@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
We have a question but we're in doubt if it's even possible or not.

The question is as follows:

Is it possible to access a form using a string literal, and if so yes?

We want to use something like this (don't mind the syntax as it obviously
doesn't work):

Form("Form1") frm = ("Form1")GetForm("Form1");

So we're able to access all the properties and methods of Form1 and not
just the methods and properties of the base class "Form".

Any help on this one is greatly appreciated!

Gerrit

Jan 26 '06 #3
OK, thank you all
I try something else i think

"Ciaran" <ci****@theodonnells.plus.com> schreef in bericht
news:43**********************@ptn-nntp-reader02.plus.net...
Nothing like that will really work. I assume you are talking about running
code typed at runtime or something.
At design time you could just do:

Form1 frm = new Form1

That would give you access to all the properties and methods.

HTH

Ciaran
"Gerrit Snel" <gs*************@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
We have a question but we're in doubt if it's even possible or not.

The question is as follows:

Is it possible to access a form using a string literal, and if so yes?

We want to use something like this (don't mind the syntax as it obviously
doesn't work):

Form("Form1") frm = ("Form1")GetForm("Form1");

So we're able to access all the properties and methods of Form1 and not
just the methods and properties of the base class "Form".

Any help on this one is greatly appreciated!

Gerrit


Jan 27 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

43 posts views Thread by ZillionDollarSadist | last post: by

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.