Results 1 to 4 of 4

Thread: Referencing controls from a module

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2003
    Posts
    90

    Referencing controls from a module

    OK, Everyone, please forgive me here. I have searched this site, look at my three books on VB.Net and can not find the answer. This is most certainly an easy task, I just can not figure it out.

    What is the proper syntax for referencing a control on a form from a module or class? Example

    Form1.Text1.Text = "this text"

    This is the old VB6 way, what is the VB.Net way?

    Thanks for your help!

  2. #2
    PowerPoster
    Join Date
    Mar 2002
    Location
    UK
    Posts
    4,780
    Its exactly the same, you just have to use the reference to the form. If this is something you havent done before then search the forums, as its a hugely popular topic for new .net developers.

    As a general help, you shouldnt really have any reason to use modules in this way in .net. They are useful for common funtions and global variables but thats about it.

  3. #3
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950
    Grimfort knows a lot more than me. But here's an example:
    VB Code:
    1. dim f as new YourFormName
    2.  
    3. f.txtSomething.text = "Howdy!"

  4. #4
    Fanatic Member
    Join Date
    Jul 2003
    Posts
    830
    Discussed it here in a similar fashiion...


    http://www.vbforums.com/showthread.p...hreadid=276604

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