Results 1 to 2 of 2

Thread: sending form to sub

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2004
    Posts
    1

    Smile sending form to sub

    i have aproblem to translet this vb6 code to vb.net


    the code:


    Public Sub ViewStatusBarProc(CurrentForm As Form)

    CurrentForm.mnuViewStatusBar.Checked = 1

    End Sub



    the problem:
    the function doesn't know that mnuViewStatusBar is member in the CurrentForm.

    in vb6 there is no problem to do it
    god will blese you friend

  2. #2
    Hyperactive Member CyberHawke's Avatar
    Join Date
    May 2004
    Location
    Washington DC
    Posts
    477
    The error you are receiving is accurate because you are declaring your object variable as a generic form. You have to explicitly set your object variable to be the active instance of the form type that you are trying to reference. You will need to write code to determine which form you are currently working with by figuring out what the form's name is and then set the object variable to the current instance of that form.

    You are venturing into an area where you need to have global instances of your forms declared and then have the ability to check the reference against the form that was passed into your procedure.

    I guess the short answer is, there is no short answer.
    Whadayamean it doesn't work....
    It works fine on my machine!

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