如何使用VB.NET程序制作表格的EXE? [英] How to make an EXE of a FORM using a VB.NET program?

查看:105
本文介绍了如何使用VB.NET程序制作表格的EXE?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是VB.NET PROGRAM如何创建exe的?

假设在我的程序中我有一个标题为另存为EXE的按钮,当我点击那个

它将表单保存为可执行文件。

我的编程语言需要这个????

任何代码????

你知道什么是编程语言?对吗?

您将代码编译成exe。

我使用VB.NET实现了一种编程语言,它可以创建Windows窗体。但是我不知道如何创建那些表格的优秀版本。

任何代码或源代码????

我知道如何在C#中创建一个exe文件。模块的NET:

这里是代码:

My question is that how can a VB.NET PROGRAM create exe''s ?
Suppose in my program i have a button with caption "save as EXE" and when i click that
it saves the form as an executable.
I need this for my programming language????
Any code for that????
You know what''s a programming language? Right?
You that it compiles the code into an exe.
I have implemented a programming language using VB.NET and it can create windows forms. But I dont know how to create excecutables of those forms.
Any code or a source for that????
I know how to make a exe file in C#.NET of a module :
Here''s the code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using System.Reflection.Emit;
namespace Asharp_Compiler
{
    class Program
    {
        static AssemblyName an;
        static AssemblyBuilder ab;
        static ModuleBuilder mb;
        static TypeBuilder tb;
        static _AppDomain ad;
        static MethodBuilder meb;
        static ILGenerator il;
        static void Main(string[] args)
        {
            ad = AppDomain.CurrentDomain;
            an = new AssemblyName("lol");
            ab = ad.DefineDynamicAssembly(an, AssemblyBuilderAccess.Save);
            mb = ab.DefineDynamicModule("Lol", "idk.exe");
            tb = mb.DefineType("lolType", TypeAttributes.Public);
            meb = tb.DefineMethod("main", MethodAttributes.Public | MethodAttributes.Static);
            il = meb.GetILGenerator();
            an.Name = "MyApp";
            ab.SetEntryPoint(meb);
            StreamReader sr = new StreamReader(args[0]);
            string Code = sr.ReadToEnd();
 
            foreach (string cmd in Code.Split('\n'))
            {
                if (cmd.StartsWith("print "))
                {
                    il.Emit(OpCodes.Ldstr, cmd.Substring(6));
                    il.Emit(OpCodes.Call, typeof(System.Console).GetMethod("Write", new System.Type[] { typeof(string)}));
 
                }
                if (cmd.StartsWith("println"))
                {
                    il.Emit(OpCodes.Ldstr, cmd.Substring(8));
                    il.Emit(OpCodes.Call, typeof(System.Console).GetMethod("WriteLine", new System.Type[] { typeof(string) }));
 
                }
            }
            il.Emit(OpCodes.Ret);
            tb.CreateType();
            ab.Save(Path.GetFileNameWithoutExtension(args[0]) + ".exe");
        }
    }
}



我可以用vb做同样的事情因为我不知道C#well


Can i do the same with vb cause i don''t know C# well

推荐答案

您好,



您可以使用即时编译:

< a href =http://www.codeproject.com/Articles/5472/Compiling-NET-code-on-the-fly>即时编译.NET代码 [ ^ ]


这篇关于如何使用VB.NET程序制作表格的EXE?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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