Private Sub Form_Load()
agl(1)'窗体名叫frma
end subpublic function agl(d as string)
dim x as string
if d = 1 then
x = frma
end ifx.text="测试用"'这里的X是frma
end function

解决方案 »

  1.   


    Option ExplicitPrivate Sub Command1_Click()
        Dim frm As Form
        
        For Each frm In Forms
            If frm.Name = "frma" Then
                frm.Caption = "这是测试用"
            End If
        Next
    End SubPrivate Sub Form_Load()
    agl (1) '窗体名叫frma
    End SubPublic Function agl(d As Long) As String
        Dim x As String
        If d = 1 Then
            agl = "frma"
        End If
    End Function
      

  2.   

    很混乱,我只来找语法错误Private Sub Form_Load()
    Call agl(1)'窗体名叫frma
    '这里最好加个Call
    end subpublic function agl(d as string)
    dim x as string
    if d = 1 then
    set x = frma '对象的话要加Set
    end ifx.Caption="测试用"'Form好象没有text属性
    end function
      

  3.   

    还漏了个, 
    Dim x as frma
      

  4.   

    语法错误
    Private Sub Form_Load()
    agl(1)'窗体名叫frma
    end subpublic function agl(d as string) '此处参数定义错误,需要改为d as long
    dim x as string
    if d = 1 then
    x = frma'此处指定需要frma的Name属性,需要改为x = frma.Name
    end ifx.text="测试用"'这里的X是frma '此处x为string类型,没有text属性,改为x = "测试用"。
    end function上面是楼主的语法错误。
      

  5.   


    Private Sub Form_Load()
    agl (1) '窗体名叫frma
    End SubPublic Function agl(d As String)
    Dim x As String
    If d = 1 Then
    x = "frma"
    End IfDim frm As FormFor Each frm In Forms
        If frm.Name = x Then
            frm.Caption = "测试用"
        End If
    Next
    End Function
      

  6.   

    Private Sub Form_Load()
        agl ("1") '窗体名叫frma
    End Sub
    Public Function agl(ByVal d As String)
        Dim x As Form
        If d = "1" Then
            Set x = Form1
        End If
        x.Text1.Text = "测试用" '这里的X是frma
    End Function