Results 1 to 4 of 4

Thread: dynamically create hashtable of forms in a vb.net project

  1. #1
    Join Date
    Mar 2006
    Posts
    35
    Rep Power
    0

    Default dynamically create hashtable of forms in a vb.net project


    Hello all,

    I need to create a hashtable collection of all the forms in my project.
    It needs to be done in code and it needs to be done without any user input.
    It also needs to be able to be portable from one project to another without rewritting any code, so the list needs to be created dynamically.

    Does anyone know how to achieve this, or can anyone point me in the correct direction?

    Thanks

  2. #2
    Join Date
    Jun 2007
    Posts
    678
    Rep Power
    0

    Default

    Don't know how much this would help but, try none the less.

    http://visualbasic.about.com/od/usin.../aa070903a.htm

    http://visualbasic.about.com/od/usin.../aa072103a.htm

    What do you need the hash table primarily for (if you are allowed to share the details)


    As soon as you make something idiot proof, Nature makes better idiots!!!

    Think big, think smart, think linux

  3. #3
    Join Date
    Mar 2006
    Posts
    35
    Rep Power
    0

    Default

    I know how to use the hashtable. So far I have my program working by sending the forms to the hastable in code. Like so...

    dim ptr as windows.forms.form
    ptr = new frmOne
    hashtable.add(ptr)

    what I would like to do is replace the code above with code that will dynamically populate the hashtable, something to the effect of...

    if projecttype\object\whatever is a system.windows.forms.form then
    hashtable.add(projecttype\object\whatever)

    I can't figure out how to do it

    I tried using reflection.assembly.getexecutingassembly however a forms BaseType is not always stated as system.windows.forms.form it can also be the project namespace.formname, which completely negates the whole purpose of using it.


    Thanks

  4. #4
    Join Date
    Jun 2007
    Posts
    678
    Rep Power
    0

    Default

    Why do you really want to do this ??? Why the hassle of going through so many loops


    As soon as you make something idiot proof, Nature makes better idiots!!!

    Think big, think smart, think linux

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •