Gemeinsam zu mehr Effizienz in der Anwendungserstellung
(→Verwendung) |
|||
Zeile 9: | Zeile 9: | ||
* Verwenden Sie aus den [https://svn.access-codelib.net/svn/DotNetLib/trunk/office/access/forms/DotNetControlContainer/Lib/ Installationsdateien] das Script ''RegisterTLBs.cmd'' um den DotNetControlContainers im System zu registrieren (Administrator-Berechtigung erforderlich). | * Verwenden Sie aus den [https://svn.access-codelib.net/svn/DotNetLib/trunk/office/access/forms/DotNetControlContainer/Lib/ Installationsdateien] das Script ''RegisterTLBs.cmd'' um den DotNetControlContainers im System zu registrieren (Administrator-Berechtigung erforderlich). | ||
- | = | + | =Beispiele= |
==Minimalbeispiel== | ==Minimalbeispiel== |
Inhaltsverzeichnis |
Option Compare Database Option Explicit Private WinForm As Object Private Sub Befehl1_Click() Dim DllPath As String DllPath = "C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll" With New NetComDomain Set WinForm = .CreateObject("Form", "System.Windows.Forms", DllPath) WinForm.Text = "Das ist ein .NET Winform" WinForm.StartPosition = 1 WinForm.ShowIcon = False WinForm.TopLevel = False End With Me.ControlContainer0.Object.LoadControl WinForm WinForm.Show End Sub
Public Class UserControl1 Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click MsgBox("Hello World") End Sub Public Function SayHello() As String SayHello = "Hallo, ich bin eine Public Function!" End Function End Class
Option Compare Database Option Explicit Private Sub Befehl1_Click() Dim DllPath As String DllPath = Application.CodeProject.Path & "\" & "ClassLibrary1.dll" Dim lib As Object With New NetComDomain Set lib = .CreateObject("UserControl1", "ClassLibrary1", DllPath) End With Me.ControlContainer0.Object.LoadControl lib MsgBox lib.SayHello Set lib = Nothing End Sub