⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 loadcomponent.vb

📁 《CSDN 开发高手》2004年第6期
💻 VB
字号:
Imports System.Windows.Forms
Public Class LoadComponent
    Private myDll As System.Reflection.Assembly
    Private obj As Object
   

    Public Function LoadComponentLibrary(ByVal ComponentFileName As String) As Boolean
        '装入指定的组件代码库
        '成功返回true
        Try
            myDll = System.Reflection.Assembly.LoadFrom(ComponentFileName)
            If myDll Is Nothing Then
                MessageBox.Show("Can't Load library")
                Return False
            End If
        Catch Errobj As SystemException
            MessageBox.Show(Errobj.Message)
            Return False
        End Try
        Return True
    End Function

    Public Function LoadClass(ByVal classname As String) As Object
        If myDll Is Nothing Then
            Return Nothing
        End If
        Try
            obj = myDll.CreateInstance(classname)
        Catch Errobj As SystemException
            MessageBox.Show(Errobj.Message)
            Return Nothing
        End Try
        Return obj

    End Function
End Class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -