Results 1 to 10 of 10

Thread: using modules in vb.net

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2002
    Posts
    58

    using modules in vb.net

    I have my main program that will use a lot of functions so i wanted to put them all in a module. But i want the functions in the module to be able to interact with the objects on the form(i.e. command buttons)

    How do i do this?
    thanks
    -------------------------------
    StupidMonkee

  2. #2
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    Create public methods in the module and call them from your
    form(s) just as you would call any other method.

  3. #3

    Thread Starter
    Member
    Join Date
    Aug 2002
    Posts
    58
    But i want the functions in the module to be able to interact with the objects on the form(i.e. command buttons)

    right now i can't get them to do that.
    -------------------------------
    StupidMonkee

  4. #4
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 2002
    Location
    The mystic land of Geordies
    Posts
    1,018
    Have you declared them as Public??

    Parksie

  5. #5
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    pass the controls you need as parameters to the routine.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  6. #6

    Thread Starter
    Member
    Join Date
    Aug 2002
    Posts
    58
    I have made them public and i tried passing them. I can't seem to pass the right object(s). or maybe i am not declaring them right.

    anyone got a bit of code to show?
    -------------------------------
    StupidMonkee

  7. #7
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    You can do what Cander said or you can pass the form in.
    Dont gain the world and lose your soul

  8. #8

    Thread Starter
    Member
    Join Date
    Aug 2002
    Posts
    58
    It is nto letting me pass the controls or the form. Can some one give me an example since my intuative responses are not seeming to work. I tried passing me. but what do i make it in the fucntion declaration? Object? tried that.

    I want to pass 4 command buittons in order to .enable = true them
    -------------------------------
    StupidMonkee

  9. #9

  10. #10

    Thread Starter
    Member
    Join Date
    Aug 2002
    Posts
    58
    That helps tremedoulsy and has the code xamples i needed.

    thanks guys and if i still have problems i will shout back
    -------------------------------
    StupidMonkee

Posting Permissions

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



Click Here to Expand Forum to Full Width