POmocy w składni kodu

sm950

Użytkownik
Dołączył
Sierpień 8, 2012
Posty
62
Mam problem ze składnią kodu pomoże ktoś ?
Kod:
Kod:
Imports Microsoft.VisualBasic
Imports System.CodeDom.Compiler
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Module Module1
        Sub Main()
            Dim kod As String = "Imports System" & vbNewLine & "Module Module1" & vbNewLine & "Sub Main()" & vbNewLine & "Console.WriteLine(" & Chr(34) & "abc" & Chr(34) & ")" & vbNewLine & "Console.ReadKey()" & vbNewLine & "End Sub" & vbNewLine & "End Module"
            If (Skompiluj(kod, "program.exe")) Then
                Process.Start("program.exe")
            Else
                MsgBox(kod)
            End If
        End Sub
        Function Skompiluj(ByVal kod As String, ByVal nazwa As String)
            Dim vb As New VBCodeProvider
            Dim icc As ICodeCompiler = vb.CreateCompiler()
            Dim parametry As New CompilerParameters
            parametry.GenerateExecutable = True
            parametry.OutputAssembly = nazwa
            Dim wynik As CompilerResults = icc.CompileAssemblyFromSource(parametry, kod)
            Return wynik.Errors.Count = 0
        End Function
    End Module
        End Sub
End Class
 
Do góry Bottom