问题描述
好的,我有一个包含多种形式的VB2005 Beta 2项目。我将Form1设置为
我的启动表单。我想改变它以使modMain的Sub Main(下面列出
)成为启动文件。我该怎么做呢?如果我转到
应用程序属性并选择Windows应用程序类型
应用程序,我只能选择一个启动表单,而不是modMain。
阅读有关异常处理的内容,我正在努力开始使用它。
谢谢,
Thomas
公共模块modMain
Public Shared Sub Main()
AddHandler Application.ThreadException,AddressOf
Application_ThreadException
尝试
Application.Run(新Form1)
Catch ex As Exception
LogException(ex)
结束尝试
结束子
私有子Application_ThreadException( ByVal sender As Object,ByVal e
As System.Threading.ThreadExceptionEventArgs)
LogException(e.Exception)
End Sub
Private Sub LogException(ByVal ex As Exception)
''代码将错误写入一个sql数据库
结束子
结束模块
-
发布通过NewsDemon.com - 高级未经审查的新闻组服务
------->>>>>> http://www.NewsDemon.com<<< <<< ------
无限制访问,匿名帐户,未经审查的宽带访问
Ok, I have a VB2005 Beta 2 project with several forms. I have Form1 set as
my startup form. I want to change this to have Sub Main of modMain (listed
below) to be the startup file. How do I do this? If I go to the
application properties and choose an Application Type of Windows
Application, I can only chose a startup Form, not the modMain.
Been reading about exception handling and I am trying to get started on it.
Thanks,
Thomas
Public Module modMain
Public Shared Sub Main()
AddHandler Application.ThreadException, AddressOf
Application_ThreadException
Try
Application.Run(New Form1)
Catch ex As Exception
LogException(ex)
End Try
End Sub
Private Sub Application_ThreadException(ByVal sender As Object, ByVal e
As System.Threading.ThreadExceptionEventArgs)
LogException(e.Exception)
End Sub
Private Sub LogException(ByVal ex As Exception)
'' code that writes error to an sql database
End Sub
End Module
--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
推荐答案
请注意VB 2005提供的应用程序事件可由
$处理b $ b点击查看应用程序事件... 我的项目按钮上的按钮
应用程序选项卡。
-
MS Herfried K. Wagner
MVP< URL:http://dotnet.mvps。 org />
VB< URL:http://classicvb.org/petition/>
Note that VB 2005 provides application events, which can be handled by
clicking the "View Application Events..." button on "My Project"''s
"Application" tab.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
这篇关于Sub Main()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!