Results 1 to 14 of 14

Thread: Open or Load a form ( urgent )

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2002
    Posts
    7

    Question Open or Load a form ( urgent )

    Hi,

    I'm trying to load into memory or open dinamicaly the forms in my program but a don't know how to do it?

    IF I DO IT LIKE THAT I ONLY GET THE CURRENT FORM NAME
    Public Function FormName() As Form
    Dim frm As Form
    Dim i as Integer

    i = 0
    For Each frm In Forms
    i = i + 1
    Set gNomesForms(i) = Forms(i)
    Next

    End Function


    Select case is out of question.

    Best Regards
    Luis Moura

  2. #2
    Junior Member
    Join Date
    Dec 2002
    Posts
    20
    Try using:

    Load frmName

    This will load your form but not show it. Then when you want to show it use:

    frmName.Show

    If you want it hidden again us:

    frmName.Hide

    To close your form use:

    Unload frmName

    HTH;
    Ancient Chinese proverb I just made up:
    Those who know the least have the most to say!

  3. #3
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    The "Forms" collection only returns forms that are already loaded

  4. #4

    Thread Starter
    New Member
    Join Date
    Dec 2002
    Posts
    7
    Thanks for answer
    that works fine if a want to load only one form, but i need to load all the forms and then open the form that the user select.

  5. #5
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    how are they 'selecting' a form to open?
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  6. #6

    Thread Starter
    New Member
    Join Date
    Dec 2002
    Posts
    7
    What do you mean "how are they 'selecting' a form to open"

  7. #7
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    You are the one that said the user is selecting a form. What does the user do to select a form?
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  8. #8

    Thread Starter
    New Member
    Join Date
    Dec 2002
    Posts
    7
    When he/she press enter in the msflexgrid to choose the mext form

  9. #9
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    So the forms are listed in the grid and they select one and hit enter?
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  10. #10

    Thread Starter
    New Member
    Join Date
    Dec 2002
    Posts
    7
    Yes, in that msflexgrid i have an hiden column with the name of the form, when the user press enter into certain item of the msflexgrid, then it should open that form.

    I could do it manual like case select, but this program has about 50 forms.

  11. #11
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    The Select Case was what I was going to suggest. That is the only option Im sorry to say.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  12. #12

    Thread Starter
    New Member
    Join Date
    Dec 2002
    Posts
    7
    Thanks any way.

    Please just look at this.
    I'st possible to set a var with all the names of the forms and then open the form direct???

    For example:

    Dim fFormName(100) as Form

    i = 0
    With rst
    Do While Not .Eof
    i = i +1
    Set fFormName(i) = !FormName
    .MoveNext
    Loop
    End With

    'Open the form
    i = 0
    For i = 0 To 100
    if fFormName(i) = sFormChoosed Then fFormName(i).Show
    Next
    Thanks

  13. #13
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    No because if the form is not loaded you cannot check its name. You would have to load every form to get that to work and that would bad.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  14. #14

    Thread Starter
    New Member
    Join Date
    Dec 2002
    Posts
    7

    Thumbs up

    Cander thanks a lot for your colaboration.

    I whis you the best holidays.

    Luis

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