CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 1999
    Posts
    16

    Passing a textbox as a function parameter

    I have a function that accepts a textbox as a parameter

    eg.

    Sub LogSetup(tb as textbox)
    'Code
    End sub

    My problem is that when I attempt to run the code, I get a type mismatch error, because VB6 thinks I am passing the default method tb.text through.

    Is there a method of disabling the default method in VB6 so that I can pass the object? Or is there a method of passing a reference to the object as the parameter like in VBA.

  2. #2
    Join Date
    Mar 2002
    Location
    Holland
    Posts
    279
    He,

    try Sub LogSetup(byref tb as textbox)..

    and if that does not work :

    Sub LogSetup(byref tb as Object)
    dim cCast as textbox

    set cCast = tb

    end sub

    Code works in VB 5...

    hope it help,

    Jewe
    A VB programmer trying to stay alive in a Real C World

    If the hardware is so great.. why use software to correct it..?? It will only slow it down..
    Al is de hardware nog zo snel de software achterhaalt het wel

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

Featured