new form

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • JB

    #1

    new form

    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 "frmEmploye e" 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
  • Cor Ligthert [MVP]

    #2
    Re: new form

    Jb,

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

    Cor

    "JB" <JB@discussions .microsoft.coms chreef in bericht
    news:5B5F1AB4-F554-4DB8-8206-FC3E260346C6@mi crosoft.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 "frmEmploye e" 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

    Comment

    • JB

      #3
      Re: new form

      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" <JB@discussions .microsoft.coms chreef in bericht
      news:5B5F1AB4-F554-4DB8-8206-FC3E260346C6@mi crosoft.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 "frmEmploye e" 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
      >
      >
      >

      Comment

      • GS

        #4
        Re: new form

        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

        "JB" <JB@discussions .microsoft.comw rote in message
        news:29BC5CD1-2D06-4A54-AB35-01B4C8C44CA7@mi crosoft.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" <JB@discussions .microsoft.coms chreef in bericht
        news:5B5F1AB4-F554-4DB8-8206-FC3E260346C6@mi crosoft.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 "frmEmploye e" 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

        Comment

        Working...