Gemeinsam zu mehr Effizienz in der Anwendungserstellung
(→DotNetDataGridView) |
(→DotNetDataGridView) |
||
Zeile 179: | Zeile 179: | ||
* Fügen Sie der Datenbank eine Tabelle mit dem Namen Tabelle1 hinzu. | * Fügen Sie der Datenbank eine Tabelle mit dem Namen Tabelle1 hinzu. | ||
+ | |||
+ | [[Datei:DotNetLib_DotNetControlContainer_DotNetDataGridView.png]] |
Inhaltsverzeichnis |
Option Compare Database Option Explicit Private Sub Befehl1_Click() Dim DllPath As String DllPath = "C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll" Dim WinForm As Object With New NetComDomain Set WinForm = .CreateObject("Form", "System.Windows.Forms", DllPath) WinForm.TopLevel = False End With Me.ControlContainer0.Object.LoadControl WinForm Set WinForm = Nothing With Me.ControlContainer0.Object.Control .Text = "Das ist ein .NET Winform" .StartPosition = 1 .ShowIcon = False .Show End With 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 Return "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" With New NetComDomain Me.ControlContainer0.Object.LoadControl .CreateObject("UserControl1", "ClassLibrary1", DllPath) End With MsgBox Me.ControlContainer0.Object.Control.SayHello End Sub
svn co https://svn.access-codelib.net/svn/DotNetLib/trunk/office/access/forms/DotNetDataGridView
Option Compare Database Option Explicit Private WithEvents GridView As DotNetDataGridView.DotNetDataGridView 'Private GridView As Object Private adodbRS As ADODB.Recordset Private Sub Form_Load() With New NetComDomain Set GridView = .CreateObject("DotNetDataGridView", "ACLibDotNet", CodeProject.Path & "\" & "DotNetDataGridView.dll") Me.ControlContainer0.Object.LoadControl GridView End With End Sub Private Sub Form_Close() Set GridView = Nothing Set adodbRS = Nothing End Sub Private Sub Befehl1_Click() Set adodbRS = New ADODB.Recordset adodbRS.Open "SELECT * FROM Tabelle1;", CurrentProject.Connection GridView.readFromRecordSet adodbRS End Sub Private Sub Befehl2_Click() GridView.setBackgroundColor 99, 155, 255 End Sub Private Sub GridView_OnBackgroundColorChanged(ByVal message As String) VBA.MsgBox "BgColor was changed to: " & message End Sub