开幕表格。 [英] Opening Forms.

查看:63
本文介绍了开幕表格。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个以模块(Sub Main)开头的应用程序,它按顺序调用几个表单。当我关闭倒数第二个表单时,将调用最后一个表单并立即关闭。我在该表单的load事件中有application.run(me),如果我在模块的开头调用它,它会打开。这是模块代码....


模块mdlLogon

Sub main()

Dim OpenFrmDbConnect As New FrmDBConnect()

OpenFrmDbConnect.Show()


如果Form1.ds = Nothing那么

Dim结果为DialogResult

Result = MessageBox.Show("您必须设置数据库连接,单击Ok执行此操作或单击取消退出程序。),Initial Setup,

MessageBoxButtons.OKCancel, _MessageBoxIcon.Exclamation,MessageBoxDefaultButton.Button1,MessageBoxOptions.ServiceNotification)

如果Result = DialogResult.OK然后

Dim OpenFrmSetup作为新的FrmSetup()

OpenFrmSetup.Show()


ElseIf Result = DialogResult.Cancel然后

退出Sub

结束如果

结束如果


Dim OpenFrmLogon作为新的FrmLogon()

OpenFrmLogon.Show()


''这是下面的电话..


Dim OpenForm1 As New Form1()

OpenForm1.Show()


结束子

结束模块


这是开车我疯了!!请有人帮忙!!!!

I have an application that starts with a Module (Sub Main) that calls a few forms in order. When I close the next to last form, the last form is called and closes immediately. I have application.run(me) in the load event for that form and it opens fine if I call it at the beginning of the module. Here is the module code....

Module mdlLogon
Sub main()
Dim OpenFrmDbConnect As New FrmDBConnect()
OpenFrmDbConnect.Show()

If Form1.ds = Nothing Then
Dim Result As DialogResult
Result = MessageBox.Show("You must setup the database connections, Click Ok to do so or Cancel to quit the program.", "Initial Setup",
MessageBoxButtons.OKCancel, _MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification)

If Result = DialogResult.OK Then
Dim OpenFrmSetup As New FrmSetup()
OpenFrmSetup.Show()

ElseIf Result = DialogResult.Cancel Then
Exit Sub
End If
End If

Dim OpenFrmLogon As New FrmLogon()
OpenFrmLogon.Show()

'' This is the call that dies below..

Dim OpenForm1 As New Form1()
OpenForm1.Show()

End Sub
End Module

This is driving me crazy!! Please someone help!!!!

推荐答案

" Shawn" < SH ********** @ ccci.org> schrieb:
"Shawn" <sh**********@ccci.org> schrieb:
我有一个以模块(Sub Main)开头的应用程序,它按顺序调用几个
表单。当我关闭倒数第二个表格时,最后一个表格被称为
并立即关闭。
I have an application that starts with a Module (Sub Main) that calls a few
forms in order. When I close the next to last form, the last form is called
and closes immediately.




\\\

公共模块计划

Public Sub Main()

Dim f As New Form1()

f.Show()

Application.Run()

End Sub

结束模块

///


在项目属性中,选择Sub Main作为启动对象。将

代码放在按钮'''点击''事件处理程序中:


\\\

Dim f2 As New Form2()

f2.Show()

Me.Close()

///


您可以通过调用''Application.ExitThread''退出应用程序。还可以看看''ApplicationContext''课程。


-

MS Herfried K. Wagner

MVP< URL:http://dotnet.mvps.org/>

VB< URL:http://classicvb.org/petition/>



\\\
Public Module Program
Public Sub Main()
Dim f As New Form1()
f.Show()
Application.Run()
End Sub
End Module
///

In the project properties, select ''Sub Main'' as startup object. Place the
code below in a button''s ''Click'' event handler:

\\\
Dim f2 As New Form2()
f2.Show()
Me.Close()
///

You can exit the application by calling ''Application.ExitThread''. Take a
look at the ''ApplicationContext'' class too.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>


这看起来像我已经拥有的......我错过了什么?


" Herfried K 。瓦格纳[MVP]" <喜*************** @ gmx.at>在消息中写道

新闻:O%**************** @ TK2MSFTNGP09.phx.gbl ...
This pretty much looks like what I already have... Am I missing something?

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:O%****************@TK2MSFTNGP09.phx.gbl...
"肖恩" < SH ********** @ ccci.org> schrieb:
"Shawn" <sh**********@ccci.org> schrieb:
我有一个以模块(Sub Main)开头的应用程序,它按顺序调用
的几个形式。当我关闭倒数第二个表格时,最后一个表格是
被叫并立即关闭。
I have an application that starts with a Module (Sub Main) that calls a fewforms in order. When I close the next to last form, the last form is calledand closes immediately.



\\\
公共模块程序
Public Sub Main()
Dim f As New Form1()
f.Show()
Application.Run()
End Sub
结束模块
///

在项目属性中,选择''Sub Main''作为启动对象。将
代码放在按钮'''点击''事件处理程序中:

\\\
Dim f2 As New Form2()
f2.Show()
Me.Close()
///

您可以通过调用''Application.ExitThread''退出应用程序。也可以看看''ApplicationContext''课程。

- MS Herfried K. Wagner
MVP< URL:http:// dotnet .mvps.org />
VB< URL:http://classicvb.org/petition/>



\\\
Public Module Program
Public Sub Main()
Dim f As New Form1()
f.Show()
Application.Run()
End Sub
End Module
///

In the project properties, select ''Sub Main'' as startup object. Place the
code below in a button''s ''Click'' event handler:

\\\
Dim f2 As New Form2()
f2.Show()
Me.Close()
///

You can exit the application by calling ''Application.ExitThread''. Take a
look at the ''ApplicationContext'' class too.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>



" Shawn" ; < SH ********** @ ccci.org> schrieb:
"Shawn" <sh**********@ccci.org> schrieb:
这几乎看起来像我已经拥有的......我错过了什么?
This pretty much looks like what I already have... Am I missing something?




也许是你的代码没有的原因工作就是你在'''加载''事件处理程序的形式中调用

''Application.Run'' - 这已经是

需要一个消息泵。


-

MS Herfried K. Wagner

MVP< URL:http:// dotnet .mvps.org />

VB< URL:http://classicvb.org/petition/>



Maybe the reason that your code doesn''t work is that you are calling
''Application.Run'' in the form''s ''Load'' event handler -- which will already
require a message pump.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>


这篇关于开幕表格。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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