Home All Groups Group Topic Archive Search About
Author
2 Oct 2006 4:44 AM
JB
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.
--
JB

Author
2 Oct 2006 4:51 AM
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

Show quoteHide quote
"JB" <J*@discussions.microsoft.com> schreef in bericht
news:5B5F1AB4-F554-4DB8-8206-FC3E260346C6@microsoft.com...
> 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.
> --
> JB
Author
2 Oct 2006 5:28 AM
JB
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.
--
JB


Show quoteHide quote
"Cor Ligthert [MVP]" wrote:

> Jb,
>
> And what advance do you think to have from that.
> That form class has to be there to create it.
>
> Cor
>
> "JB" <J*@discussions.microsoft.com> schreef in bericht
> news:5B5F1AB4-F554-4DB8-8206-FC3E260346C6@microsoft.com...
> > 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.
> > --
> > JB
>
>
>
Author
2 Oct 2006 4:45 PM
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

Show quoteHide quote
"JB" <J*@discussions.microsoft.com> wrote in message
news:29BC5CD1-2D06-4A54-AB35-01B4C8C44CA7@microsoft.com...
> 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.
> --
> JB
>
>
> "Cor Ligthert [MVP]" wrote:
>
> > Jb,
> >
> > And what advance do you think to have from that.
> > That form class has to be there to create it.
> >
> > Cor
> >
> > "JB" <J*@discussions.microsoft.com> schreef in bericht
> > news:5B5F1AB4-F554-4DB8-8206-FC3E260346C6@microsoft.com...
> > > 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.
> > > --
> > > JB
> >
> >
> >