---make.cmd--- @echo off for /f "usebackq" %%d in (`dir/w %WINDIR%\Microsoft.NET\Framework ^| findstr [v`) do set dotnetdir=%%d set dotnetdir=%dotnetdir:[=% set dotnetdir=%dotnetdir:]=% rem echo %dotnetdir% set VBCOMPILER=%windir%\Microsoft.NET\Framework\%dotnetdir%\vbc.exe %VBCOMPILER% /target:library /platform:anycpu /out:MyModule.dll MyModule.vb %VBCOMPILER% /target:winexe /platform:anycpu /r:MyModule.dll /main:Form1 /out:test.exe Main.vb pause ---end make.cmd--- ---MyModule.vb--- Imports System Public Class MyModule Private str As String Public Sub New() str = "new" End Sub Public Function SetStr(s As String) As Integer str = s Return 0 End Function Public Function GetStr() As String Return str End Function End Class ---end MyModule.vb--- ---Main.vb--- Imports System Imports System.Windows.Forms Public Class Form1 Inherits Form Public TextBox1 As TextBox Public WithEvents Button1 As Button Public WithEvents Button2 As Button Public MyModule1 As MyModule Public Sub New() MyModule1 = New MyModule Me.Width = 335 Me.Height = 100 Me.Text = "sample" TextBox1 = New TextBox TextBox1.Top = 10 TextBox1.Left = 10 TextBox1.Width = 150 Me.Controls.Add(TextBox1) Button1 = New Button Button1.Top = 10 Button1.Left = 165 Button1.Text = "Set" Button1.Width = 70 Me.Controls.Add(Button1) Button2 = New Button Button2.Top = 10 Button2.Left = 240 Button2.Text = "Get" Button2.Width = 70 Me.Controls.Add(Button2) End Sub Private Sub Button1_Click(Byval sender As Object, ByVal e As System.EventArgs) Handles Button1.Click MyModule1.SetStr(TextBox1.Text) End Sub Private Sub Button2_Click(Byval sender As Object, ByVal e As System.EventArgs) Handles Button2.Click MessageBox.Show(MyModule1.GetStr()) End Sub Shared Sub Main() Application.EnableVisualStyles() Application.Run(New Form1) End Sub End Class ---end Main.vb---