passing a module name as a variable

Discussion in 'Questions (Windows Mobile)' started by Cableguy, Oct 24, 2008.

  1. Cableguy

    Cableguy Expert Licensed User

    How can I do this?
    If I want to use 1 module and its forms consist of reusable panels, wich I change the parent....How to refer to a module using a string variable, in or der to callback a public sub from that module, commom to all modules...
    If there's not yet a Keyword for it, it probably would be a good time to add a "Module(string)" keyword...
     
  2. Ricky D

    Ricky D Well-Known Member Licensed User

    not sure exactly what you're saying

    but I'll try.

    In my taxi app i use "Shifts.frmShifts" and that works where code requires the form in the Shifts module. I have a panel on frmShifts that I use on 2 other forms. Here is a menu click sub that changes the parent of the panel then runs a sub in Utils that sets up the data on the panel and finally brings it to the front and makes it visible.

    Sub mnuShiftStatsEdit_Click
    flibFareEdit.ChangeParent("shifts.pnlShiftStats","frmFareEdit")
    utils.CalcShiftStats
    shifts.pnlShiftStats.Visible=True
    shifts.pnlShiftStats.BringToFront
    End Sub

    I hope this might help you.

    regards, Ricky
     
  3. Cableguy

    Cableguy Expert Licensed User

    That works if you hard code the module name, but I want to pass it as a variable, in a string...

    Control(modulename).modulesub does not work...
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    You should use:
    Code:
    CallSub(ModuleName & "." & subName)
    You can see an example of using a callback sub in the FolderChooser sample (c:\Program Files\Anywhere Software\Basic4ppc Desktop\Samples).
     
  5. Cableguy

    Cableguy Expert Licensed User

    I HAD FORGOTTEN ALL ABOUT CALLSUB, AS i NEVER HAD USED IT BEFORE....

    BTW: MY FORMLIB PROBLEM IS SOLVED...
     
    Last edited: Oct 24, 2008
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice