VB.net program with no UI

拈花ヽ惹草 提交于 2019-12-12 13:23:06

问题


I'm making a VB.net program via a text file and I'm compiling it using vbc.exe via command line. I'm trying to get just a simple program to run in the background of my computer. Problem is, it displays the annoying console window. How do I get nothing to show? No form, no console?


回答1:


I think you need a form of some kind to keep the message loop going.

Maybe a NotifyIcon type program. It would keep it away from the task bar and desktop areas.

And then customize the NotifyIcon to "Only Show Notifications" from the "Customize" menu for your icon using Windows.




回答2:


Just use windows forms application don't load the form at all! Just go in project properties and uncheck enable application framework. Now, in the startup object dropdown, select "sub main". Add a module to the project and put a Public Sub Main() in it. You do all the stuff in main() and don't load form at all.




回答3:


1) Add a module in your project, and create Sub Main
2) Write whatever you want in Sub Main,and MAKE SURE you end it with this statement:

Application.Run()

3) Open properties of your project and choose "Sub Main" as startup object

So , your application will have NO INTERFACE (NO FORM / NOT CONSOLE APPLICATION) and will run from Sub Main(), in addition it will NOT TERMINATE once all the code in Sub Main has executed.Your program will run like a NORMAL windows form application, and will only exit when you want.



来源:https://stackoverflow.com/questions/8168304/vb-net-program-with-no-ui

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!