new form

G

Guest

My problem is how to create a form given the name of the form class as a
string. In essence, I would like to be able to create an instance of
frmEmployee by using Dim frm as Form = New "frmEmployee" instead of New
frmEmployee. It there any way to do this. I want to use a single event
handler to create any form selected by the user. A property of the button
that fires the event is the name of the form.
 
C

Cor Ligthert [MVP]

Jb,

And what advance do you think to have from that.
That form class has to be there to create it.

Cor
 
G

Guest

I think I found the answer to my question in another post a few pages in.
The reason for all this is that the "menu" of buttons is created dynamically
at run time based on data from tables in an sql database. The form classes
exist but the menu doesn't until runtime. When the user clicks a btn, the
handler common to all the btns gets the form name from a property of the btn.
Now I have found out that reflection allows me to do what I want. I know
little about reflection so I will do some more reading. The reason for all
this is that the menu configuration is dependent of a number of factors,
including among others the access level of the user. I can add forms,
rearrange the menu, etc by just chaning a few table entries in an sql
database. I don't have to do anything in the front end program at all,
except add any new forms or course, but I don't have reprogram the menu each
time i want to change things.
 
G

GS

Great Idea, assuming the SQL db is secured properly. otherwise someone can
grant himself access


as for debugging / maintaining the application by other people, they will
need good documentation
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top