如何在Visual Basic中修复此代码? [英] How do I fix this code in Visual Basic?

查看:87
本文介绍了如何在Visual Basic中修复此代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一段代码,我用CodeDOM编译。但是,当我执行程序时,它只是说程序已经停止工作......。

我该如何解决这个问题? CodeDOM程序中的代码如下:

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
        System.Windows.Forms.Application.Run(FrmMain)
    End Sub
End Class
Public Class MainForm
    Inherits System.Windows.Forms.Form
    Private WithEvents EventWB As New WebBrowser
    Sub New()
        Application.EnableVisualStyles()
        Me.Text = My.Resources.Addresser
        EventWB.Dock = DockStyle.Fill
        EventWB.Navigate(My.Resources.Addresser)
        Me.Controls.Add(EventWB)
        Me.Size = New Size(640, 480)
    End Sub
End Class
Namespace My.Resources

    '''<summary>
    '''  A strongly-typed resource class, for looking up localized strings, etc.
    '''</summary>
    <Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
     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

        '''<summary>
        '''  Returns the cached ResourceManager instance used by this class.
        '''</summary>
        <Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
        Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
            Get
                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

        '''<summary>
        '''  Overrides the current thread's CurrentUICulture property for all
        '''  resource lookups using this strongly typed resource class.
        '''</summary>
        <Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
        Friend Property Culture() As Global.System.Globalization.CultureInfo
            Get
                Return resourceCulture
            End Get
            Set(value As Global.System.Globalization.CultureInfo)
                resourceCulture = value
            End Set
        End Property

        '''<summary>
        '''  Looks up a localized string similar to Blah.
        '''</summary>
        Friend ReadOnly Property Addresser() As String
            Get
                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()
        cp.ReferencedAssemblies.Add("System.dll")
        cp.ReferencedAssemblies.Add("System.Windows.Forms.dll")
        cp.ReferencedAssemblies.Add("Microsoft.VisualBasic.dll")
        cp.ReferencedAssemblies.Add("System.Drawing.dll")
        cp.ReferencedAssemblies.Add("System.Core.dll")
        cp.ReferencedAssemblies.Add("mscorlib.dll")
        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)
            res.Generate()
            res.Close()
        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
            MessageBox.Show(errors.Errors(0).ToString)
        End If





提前致谢,

iProgramIt



Thanks in advance,
iProgramIt

推荐答案

我们无法分辨。如果可以的话,我们无法运行您的程序,也无法访问您的数据!

因此,首先在调试器中运行它 - 在表单的开头添加一个入口点New方法,并逐步完成您的计划。在执行之前仔细查看每一行,并确切地确定它应该做什么。然后看看它是否确实如此。如果不是,为什么不呢?



对不起 - 但是在你至少有一些关于应用程序在哪里的数据的数据之前,我们无法为你做任何事情。错误的以及它应该做什么的一些想法!
We can't tell. We can't run your program, and don't have access to your data if we could!
So start by running it in the debugger - put an entry point at the start of the forms New method, and step your program through. Look carefully at each line before you execute it, and work out exactly what it should do. Then see if it does exactly that. If not, why not?

Sorry - but we can't do anything for you until you have at least some data as to where in your app it is "going wrong" and some idea of what it should be doing instead!


这篇关于如何在Visual Basic中修复此代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆