如何生成修改后的预建表单的.exe文件? [英] How to generate .exe file of a modified pre-builded form?

查看:134
本文介绍了如何生成修改后的预建表单的.exe文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

各位大家好,希望我没有错。

我正在尝试用VB.NET创建一个程序,我疯了,所以如果有人能帮助我,他会做的非常有利!



这是一个问题:我的项目有两个表格;



在form1中有两个按钮和一个文本框,在form2中只有一个标签。



我想在form1上的文本框中插入一个名称后,按第一个按钮插入名称复制到form2上的标签(我做了这个;))并按下第二个按钮,它出现一个savefiledialog,允许我保存我的form2的.exe文件(我之前选择的标签更改文本)。



那么,我怎样才能将表单保存到.exe中,具体取决于我之前修改过的值?



我尝试将form2和form2.designer.vb的源代码复制到My.Resources中的.txt文件中,然后我尝试使用CodeDom编译器编译它但它不起作用,它出现了很多错误,似乎它无法编译vb.net字符串(?)



所以我不知道是否有任何方法可以做到这一点。



也许很容易,但我真的很疯狂。



希望有人可以帮助我,任何想法或任何提示,不要犹豫问你是否不理解一切,我会试着更好地解释。



感谢任何人,对不起我的英语不好。

Hello everybody, hope I don't wrong anything.
I'm trying to create a program in VB.NET and I'm going crazy, so if anyone could help me he would make a great favor!

Here's the question : I have two form on my project;

In form1 there is two button and one textbox, in form2 there is just one label.

I want that after I insert a name on the textbox on form1, by pressing the first button the name inserted goes copied into the label on the form2 (and I did this ;) ) and by pressing the second button it appear a savefiledialog that allow me to save an .exe file of my form2 (with the label changed text i chose before).

So, how can I save a form into .exe depending on the modified value I insterted before?

I tried by copying the source of form2 and form2.designer.vb into a .txt file in My.Resources and after I tried to compile it with the CodeDom Compiler but it doesn't work, it appears so many errors and seems it cannot compile vb.net strings (?)

So I don't know if there is any methods to do this.

Maybe is easy but I'm really getting crazy.

Hope someone could help me, any idea or any tips, don't hesitate to ask if you didn't understand everything, I'll try to explain better.

Thanks to anybody and sorry my bad english.

推荐答案

这是另一种方法:

如何创建从文件加载配置数据的exe?例如,您可以从文本文件加载标签文本,并在表单加载时设置它。您只需要通过其他应用程序更改文本文件。
This is alternative approach:
how about creating exe which load configuration data from file? for example you can load the label text from text file and set it when form load. You only need to change the text file by other application.


不,您不能将表单另存为.exe。这根本不可能。



您必须使用CodeDOM构建整个应用程序,然后将您发送到标签的文本作为字符串常量添加到此应用程序中码。然后使用CodeDOM将该代码编译到它自己的.EXE中。



警告!这是SH * T-TON的工作!解决方案1中的答案会更好。只需将文本写入第二个应用程序刚刚加载的配置文件中。
No, you cannot "save a form as an .exe". It's simply not possible.

You have to use the CodeDOM to build an entire application and then add your text that you sent to a label as a string constant into this app code. You then use CodeDOM to compile that code into it's own .EXE.

Warning! It is a SH*T-TON of work to do this! You'd be better off with the answer in Solution 1. Just write the text to a config file that your second app just loads.


这篇关于如何生成修改后的预建表单的.exe文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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