Results 1 to 6 of 6

Thread: What's wrong with this? "a module is not a valid type" ERROR (RESOLVED)

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2002
    Posts
    196

    What's wrong with this? "a module is not a valid type" ERROR (RESOLVED)

    I get an "a module is not a valid type" error when I try to compile this code. Can I not pass a label to a function?

    VB Code:
    1. Private Function SetLabel(CT As String, lbl As Label)
    2.     lbl.Tag = CT
    3. End Function
    Last edited by brandoom; Jul 15th, 2004 at 12:40 AM.
    Brandon S Davids

  2. #2
    Frenzied Member Spajeoly's Avatar
    Join Date
    Mar 2003
    Location
    Utah
    Posts
    1,068
    Don't use Private Function, just use Function.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Dec 2002
    Posts
    196
    That doesn't work.

    I've tried

    Private Sub
    Public Sub
    Private Function
    Public Function
    Function
    Sub

    FYI, the procedure is in a forms code and I get the same error if I move the function to a module.

    Any other ideas?
    Brandon S Davids

  4. #4
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    Change lbl As Label to Byval lbl As Label
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Dec 2002
    Posts
    196
    ByVal or ByRef don't matter, I still get that error.

    I can put that function into it's own project and it works fine though.
    Brandon S Davids

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Dec 2002
    Posts
    196
    If I change the "lbl as Label" to: "lbl as Control" it works fine. I still can't figure out what is wrong with passing it as a Label.
    Brandon S Davids

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