Results 1 to 5 of 5

Thread: Loading Forms

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Location
    U.S.A.
    Posts
    75

    Post

    I have a savefile where I keep the name of the form that I want to load(as a string). Problem is I cant load this form using just the string.

    example:
    Say the name of the form is frmMain
    You bring the name of the form in as a string

    dim frm as string

    frm = "frmMain"
    Load frm

    this will not work as frm is a string not an object

    Question is how do I relate the the string to the object I want to load(in this case a form frmMain)?

    And how do I go about loading the form once the relation is made?


    Thanks

  2. #2
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    AFAIK the only thing you can do is:

    a) loading existing forms
    b) loading new forms from an array (ie "load frmMain(1)")
    c) use the API to load a new form, but then it will not be named as your string

  3. #3
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    I think you could use the name property
    Code:
    For each item in Forms
    if item.name=Yourstring then load item
    next item
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Location
    U.S.A.
    Posts
    75
    Kedaman your example would work if I had all of the forms loaded into memory but I do not.

    Unfortunately the forms collection does not include those forms that are not loaded

    Is there any way to cycle through all of the forms in a project even though they are not loaded into memory?

    If not then I guess I will have to be stuck with my original idea, using a long case structure.

    [Edited by Mithyrl on 05-01-2000 at 01:46 PM]

  5. #5
    Hyperactive Member
    Join Date
    Mar 2000
    Posts
    292
    Well you could put all the names into a String array and loop through, but that isnt a much better solution then your big case statement.
    "People who think they know everything are a great annoyance to those of us who do."

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