DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Loading forms

  1. #1
    Nauj Guest

    Loading forms


    I've made an app with lot of forms. When I go from one form to another. I
    make this:
    -------------
    Load Form1
    Form1.show vbmodal
    -------------
    Making this I go from form1 to form2.
    My problem is that in my app I should be able to go from any form to any
    other form. Then, it's possible that when I go from form1 to form2, form2
    can be loaded and visible, yet. I have a run-time error:
    ----------------
    Run-time error: 400
    The form is already visible. It can't be loaded in modal way
    ---------------
    How can I validate if form2 is already loaded?. Which is teh best way to
    go from one form to other?.
    Any solutions will be gretaly apreciatted.

    Nauj


  2. #2
    Alan Gillott Guest

    Re: Loading forms

    If you set vbModal, then a form cannot be visible. When you return from a
    modal call the form can be invisible or unloaded. I'm not sure from your
    description what's going on as you claim the forms are being loaded modally
    but then say form two is already visible.

    You need took carefully at your form navigation logic. Either all your form
    navigation must be managed by a driver routine and the forms made visible
    and invisible alternately or, if you must have form1 & form2 invoke each
    other then you cannot open them modally.

    Of course that means the user, not your program controls which form is
    active. I have on occasion worked around this by using the Form.Enabled
    property BUT, you must BE CAREFUL, it is very easy to end up with two
    disabled forms.
    Nauj <juanvidalgil@yahoo.com> wrote in message
    news:38d8df09$1@news.devx.com...
    >
    > I've made an app with lot of forms. When I go from one form to another. I
    > make this:
    > -------------
    > Load Form1
    > Form1.show vbmodal
    > -------------
    > Making this I go from form1 to form2.
    > My problem is that in my app I should be able to go from any form to any
    > other form. Then, it's possible that when I go from form1 to form2, form2
    > can be loaded and visible, yet. I have a run-time error:
    > ----------------
    > Run-time error: 400
    > The form is already visible. It can't be loaded in modal way
    > ---------------
    > How can I validate if form2 is already loaded?. Which is teh best way to
    > go from one form to other?.
    > Any solutions will be gretaly apreciatted.
    >
    > Nauj
    >




  3. #3
    Colin McGuigan Guest

    Re: Loading forms

    Nauj wrote in message <38d8df09$1@news.devx.com>...
    >How can I validate if form2 is already loaded?. Which is teh best way to
    >go from one form to other?.
    >Any solutions will be gretaly apreciatted.
    >
    >Nauj
    >


    Check the Forms collection:

    <vaporcode>
    Public Function IsFormLoaded(strForm As String) As Boolean
    'Eg: IsFormLoaded("Form2")
    Dim frm As Form

    IsFormLoaded = False
    For Each frm In Forms
    If frm.Name = strForm Then
    IsFormLoaded = True
    Exit Function
    End If
    Next frm
    End Function
    </vaporcode>
    --
    Colin McGuigan




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center