0 Replies - 449 Views - Last Post: 01 October 2015 - 12:32 AM Rate Topic: -----

#1 iProgramIt   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 19-July 15

How do I fix this code in Visual Basic and CodeDOM?

Posted 01 October 2015 - 12:32 AM

Hi guys,
I have a piece of code, which I am compiling with CodeDOM. However, when I execute the program, it just says "The program has stopped working..".
How can I fix this? The code in the CodeDOM program is here:
Option Strict On
Imports System
Imports System.Windows.Forms
Imports System.Windows.Forms.Form
Imports System.Drawing
Imports Microsoft.VisualBasic
Public Class EntryPoint
    Public Shared Sub Main(args() As String)
        Dim FrmMain As New MainForm
    End Sub
End Class
Public Class MainForm
    Inherits System.Windows.Forms.Form
    Private WithEvents EventWB As New WebBrowser
    Sub New()
        Me.Text = My.Resources.Addresser
        EventWB.Dock = DockStyle.Fill
        Me.Size = New Size(640, 480)
    End Sub
End Class
Namespace My.Resources
    '''  A strongly-typed resource class, for looking up localized strings, etc.
    <Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", ""), _
     Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
     Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
     Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
    Friend Module Resources
        Private resourceMan As Global.System.Resources.ResourceManager
        Private resourceCulture As Global.System.Globalization.CultureInfo
        '''  Returns the cached ResourceManager instance used by this class.
        <Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
        Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
                If Object.ReferenceEquals(resourceMan, Nothing) Then
                    Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("WindowsApplication1.Resources", GetType(Resources).Assembly)
                    resourceMan = temp
                End If
                Return resourceMan
            End Get
        End Property
        '''  Overrides the current thread's CurrentUICulture property for all
        '''  resource lookups using this strongly typed resource class.
        <Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
        Friend Property Culture() As Global.System.Globalization.CultureInfo
                Return resourceCulture
            End Get
            Set(value As Global.System.Globalization.CultureInfo)
                resourceCulture = value
            End Set
        End Property
        '''  Looks up a localized string similar to Blah.
        Friend ReadOnly Property Addresser() As String
                Return ResourceManager.GetString("Addresser", resourceCulture)
            End Get
        End Property
    End Module
End Namespace

The code I use to compile it is here:
Dim cp As CompilerParameters = New CompilerParameters()
        Dim provider As CodeDomProvider = CodeDomProvider.CreateProvider("VisualBasic")
        cp.GenerateExecutable = True
        cp.OutputAssembly = "C:\Okay.exe"
        cp.MainClass = "EntryPoint"
        Using res As New ResourceWriter(Application.LocalUserAppDataPath & "\resources.resources")
            res.AddResource("Addresser", TextBox1.Text)
        End Using
        cp.EmbeddedResources.Add(Application.LocalUserAppDataPath & "\resources.resources")
        cp.CompilerOptions = "/target:winexe"
        Dim errors As System.CodeDom.Compiler.CompilerResults = provider.CompileAssemblyFromSource(cp, My.Resources.Executioner)
        If errors.Errors.HasErrors Then
        End If

Also, the program that stops working is: Attached File  Okay.zip (3.79K)
Number of downloads: 12
Thanks in advance,

Is This A Good Question/Topic? 0
  • +

Page 1 of 1