请问各位大哥,大姐们
我想在VB程序中调用这个函数,求这个函的返回的值,这个值是在函数中已经给好的。
我怎样在自定义的DLL函数中,直接让它返回一个值(字符串或数字)呀?我用的是VB写的程序,

解决方案 »

  1.   

    Option ExplicitPublic clsaa As Class1Private Sub Command1_Click()
      Set clsaa = New Class1
      
      MsgBox clsaa.aa
    End Sub-----class1---
    Option ExplicitPublic Function aa()
       aa = "hello "
    End Function
      

  2.   

    Option ExplicitPublic clsaa As Class1Private Sub Command1_Click()
      Set clsaa = New Class1
      
      MsgBox clsaa.aa
    End Sub-----class1---
    Option ExplicitPublic Function aa()
       aa = "hello "
    End Function
      

  3.   

    这是我函数中的内容:
    Public Sub cha()    Dim cn5 As New ADODB.Connection
            cn5.ConnectionString = ""
            cn5.Open
        Dim rs5 As New ADODB.Recordset
        Dim sql5 As String
            rs5.CursorLocation = 3
            sql5 = "select * from chi where cc='sycs'"
            rs5.Open sql5, cn5, adOpenDynamic, adLockBatchOptimistic
            dim zh_eng as string
            If rs5.Fields(4) = 加密值 Then
                zh_eng = "正版"
            Else
                zh_eng = "盗版"
            End If
    End Sub
    我怎样把这个"zh_eng"的值传到我的VB程序里呀!!谢谢
      

  4.   

    1.使用function 后带类型传回,即莫依的方法
        Public Function cha() as string
            ...
            If rs5.Fields(4) = 加密值 Then
                cha = "正版"
            Else
                cha = "盗版"
            End If
        End Function2.模块中再定义变量
    函数中:
      public zh_eng as string调用时:
     执行方法
        cha
     使用结果
        msgbox class1.zh_eng
      

  5.   

    public property get cha() as string
        cha=zh_eng  '正版、盗版
    end property
      

  6.   

    Public Sub cha(byval zh_eng as string)不就行了?