Results 1 to 8 of 8

Thread: Modal Form

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2009
    Location
    Anywhere I want to.
    Posts
    350

    Modal Form

    I want to set parameters on a form then show modal.

    Set fForm = frmMine
    Load fForm

    fForm.AParam = "123"

    fForm.Show me, vbModal ' cannot because form already loaded.

    Is there an API way ?

    This is for an embedded PC anf the form being shown must be visible and nothing else can sit on top.
    Controls on this form can close it.

  2. #2
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    6,426

    Re: Modal Form

    Remove the line with the load statement

  3. #3
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    10,738

    Re: Modal Form

    Quote Originally Posted by LorinM View Post
    I want to set parameters on a form then show modal.

    Set fForm = frmMine
    Load fForm

    fForm.AParam = "123"

    fForm.Show me, vbModal ' cannot because form already loaded.

    Is there an API way ?

    This is for an embedded PC anf the form being shown must be visible and nothing else can sit on top.
    Controls on this form can close it.
    LorinM,

    I just see two problems:

    1) You never instantiated your form: Set fForm = New frmMine

    2) You reversed the arguments to show it. It should be: fForm.Show vbModal, me
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2009
    Location
    Anywhere I want to.
    Posts
    350

    Re: Modal Form

    1) yes I do but did not show.
    2) my bad. a dyslectic typo.

    Is there no API that will make the form Modal after all has settled down ?

  5. #5
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    6,426

    Re: Modal Form

    I use the following often:
    Code:
    Dim fTest As frmTest
    
    Set fTest = new frmTest
    fTest.PropertyA = “Test”
    fTest.Show vbModal

  6. #6
    New Member
    Join Date
    Jul 2024
    Posts
    7

    Re: Modal Form

    i Use

    in FormParent (pForm)
    Code:
    Private Sub Command_click()
     Label1.tag = "123" 'Something with TAG
     cForm.Show [1]
    End Sub
    in FormChild (cForm)
    Code:
    Private Sub Form_Load()
     Dim Value as String
     Value = pForm.Label1.tag 
     pform.label.tag = ""
    End sub

  7. #7
    Hyperactive Member gaouser's Avatar
    Join Date
    Mar 2022
    Location
    World:\Turkey\User32.DLL
    Posts
    510

    Re: Modal Form

    Quote Originally Posted by LorinM View Post
    I want to set parameters on a form then show modal.

    Set fForm = frmMine
    Load fForm

    fForm.AParam = "123"

    fForm.Show me, vbModal ' cannot because form already loaded.

    Is there an API way ?

    This is for an embedded PC anf the form being shown must be visible and nothing else can sit on top.
    Controls on this form can close it.
    I got 2 ways.

    Code:
    Set fForm = frmMine
    
    fForm.AParam = "123"
    
    fForm.Show me, vbModal
    Code:
    Set fForm = frmMine
    Load fForm
    
    fForm.Show me, vbModal
    
    fForm.AParam = "123"
    MicrosoftWindowsxp
    Professional

    was the peak Windows version not gonna lie

  8. #8
    Member
    Join Date
    Mar 2020
    Posts
    45

    Re: Modal Form

    What I do in this case :

    Form1 :
    Code:
    Option Explicit
    
    Private Sub Command1_Click()
        Form2.Parameter = "Essai"
        Form2.Show vbModal, Me
    End Sub
    Form2 :
    Code:
    Option Explicit
    
    Private frmParameter As String
    
    Private Sub Form_Load()
        
        Debug.Print frmParameter
        
    End Sub
    
    Public Property Get Parameter() As String
        Parameter = frmParameter
    End Property
    
    Public Property Let Parameter(ByVal sValue As String)
        frmParameter = sValue
    End Property

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