Results 1 to 2 of 2

Thread: pass data to different form when user key in different form name using textbox

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2010
    Posts
    16

    pass data to different form when user key in different form name using textbox

    I want let user pass a data through mscomm. My idea as below:

    1. create a T1.form
    2. create textbox1 and textbox2 at different form
    3. user key in T1 at textbox1 and 2 in textbox2
    4. the 2 will pass to msflexgrid.textmatrix(1,1) at form T1
    5. the form name is create by user after the program done, not designer, so the designer would not know the form name

    the idea example code:
    ---------------------
    ' the a is form name and selected by user
    a = text1.text

    'b is the data pass to the form
    b = text2.text

    'problem at here
    a.msfelxgrid.textmatrix(1,1) = b

    but this example cannot be use, can someone help for this or have other better idea other than this?

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: pass data to different form when user key in different form name using textbox

    As long as form was created in design time you may create an instance of it using vode similar to this:
    Code:
    Option Explicit
    
    Private Sub Command1_Click()
    Dim frm As Form
    Dim myForm As Form
    
        For Each frm In Forms
            If LCase(frm.Name) = Trim(Text1.Text) Then
                Set myForm = frm
                Exit For
            End If
        Next frm
        
        If myForm Is Nothing Then
            Set myForm = Forms.Add(Trim(Text1.Text))
        End If
        
        myForm.Show
        myForm.Text1.Text = Me.Text2.Text
    
    End Sub

Tags for this Thread

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