Form.Show无法正常工作 [英] Form.Show not working properly

查看:73
本文介绍了Form.Show无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

VB.Net Express2008.Windows窗体应用程序.应用程序框架工作已禁用.

以下是我的代码:

模块Module1

子main()

Dim frm1作为新Form1


frm1.Show()

Dim xl作为Microsoft.Office.Interop.Excel.Application

xl = CreateObject("Excel.Application")

xl.Visible = True

frm1.Hide()

结束子

终端模块

我想在打开Excel时显示等待消息.

表格显示不正确.所有标签和文本框都显示为孔",而不显示桌面中的文本.

VB.Net Express 2008. Windows forms application. Application frame work disabled.

Following is my code:

Module Module1

Sub main()

Dim frm1 As New Form1


frm1.Show()

Dim xl As Microsoft.Office.Interop.Excel.Application

xl = CreateObject("Excel.Application")

xl.Visible = True

frm1.Hide()

End Sub

End Module

I want to show a Wait message while Excel is being opened.

The form does not show properly. All the labels and text boxes show as ''holes'' displaying the desktop instead of text inside it.

推荐答案

因为您是从Main运行的,而不是放任自流在框架上执行此操作,您必须以不同的方式启动表单以设置应用程序的消息泵.

代替Form.Show,您可以执行以下操作:
Since you''re runnint from Main instead of letting the framework do it, you have to launch the form differntly to setup the app''s message pump.

Instead of Form.Show, you do this:
Dim frm1 As New Form1
Application.Run(frm1)



Application.Run是一个阻塞调用,因此在关闭表单之前,不会执行任何代码.



Application.Run is a blocking call, so no code after it will execute until the form is closed.


这篇关于Form.Show无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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