VB.NET和FORMS(Form.Show,Form.Hide ......) [英] VB.NET and FORMS (Form.Show, Form.Hide ... )

查看:258
本文介绍了VB.NET和FORMS(Form.Show,Form.Hide ......)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在从Vb6迁移到VB.Net。我有一种感觉这已经出现了

之前...


VS.Net MSDN文件似乎表明以下内容应该有效:


Form1.Show

Form1.Visible = True

Form1.Hide

Form1.Visible = False

加载(Form1)

卸载(Form1)或者关闭(Form1)


然而,如你所知,这些都不是工作。我还检查了一本关于将VB6转换为VB.Net的书,并且它似乎也说上面是

正确。所以我猜我的语法错了。更正将是值得赞赏的,特别是因为我已经把我的头发拉出来了,所以我开始低头发了......


谢谢


I''m moving from Vb6 to VB.Net. I have a feeling this has come up
before...

The VS.Net MSDN file seems to state that the following should work:

Form1.Show
Form1.Visible = True
Form1.Hide
Form1.Visible = False
Load (Form1)
Unload (Form1) or perhaps Close (Form1)

Yet, as you know, none of these work. I also checked a book on
converting VB6 to VB.Net, and it also seems to say that the above is
correct. So I''m guessing my syntax is wrong. Corrections will be
appreciated, particularly since I''ve been pulling my hair out doing
this and I''m starting to run low on hair...

Thanks

推荐答案

Dim f As New System.Windows.Forms.Form()


f.lblDesc.Text ="你是否像这样实例化你的新表格?


f.Show()或.. 。


f.showdialog()用于模态形式


Me.Close()来自形式内的模态或...


f.Close()或......


f.Hide()


f.dispose ()


< ge *********** @ lycos.com>在消息中写道

新闻:sg ******************************** @ 4ax.com ...
Dim f As New System.Windows.Forms.Form()

f.lblDesc.Text = "Did you instantiate your new form like this?"

f.Show() or...

f.showdialog() for modal form

Me.Close() from within form for modal or...

f.Close() or...

f.Hide()

f.dispose()

<ge***********@lycos.com> wrote in message
news:sg********************************@4ax.com...

我正在从Vb6迁移到VB.Net。我感觉之前已经出现了


VS.Net MSDN文件似乎表明以下内容应该有效:

Form1.Show
Form1.Visible = True
Form1.Hide
Form1.Visible = False
加载(Form1)
卸载(Form1)或者关闭(Form1)
然而,如你所知,这些都不起作用。我还检查了一本关于将VB6转换为VB.Net的书,它似乎也说上面是正确的。所以我猜我的语法错了。更正将受到赞赏,特别是因为我一直在拉我的头发做这个而且我开始低头发...

谢谢

I''m moving from Vb6 to VB.Net. I have a feeling this has come up
before...

The VS.Net MSDN file seems to state that the following should work:

Form1.Show
Form1.Visible = True
Form1.Hide
Form1.Visible = False
Load (Form1)
Unload (Form1) or perhaps Close (Form1)

Yet, as you know, none of these work. I also checked a book on
converting VB6 to VB.Net, and it also seems to say that the above is
correct. So I''m guessing my syntax is wrong. Corrections will be
appreciated, particularly since I''ve been pulling my hair out doing
this and I''m starting to run low on hair...

Thanks



Hi Genetic,

我猜你正试图做那些事情从另一个表格。在

这种情况​​下它< has>之前会再次出现(并且会再次!!)


VB6中的Form1可用于获取实例化的表单。 Form1.Visible是

实际Form的Visible属性。


VB.NET中的Form1是< class>表格的实例可以从中创建
。 Form1作为<对象>不再适用。 Form1.Visible失败,因为

它要求该类的Visible属性,并且该类没有

一个 - 它只能用于实例课程。


如果你想从另一个表格(或其他

班级)访问你的''Form1'',你需要引用那个

Form1的实例。这可以全局存储在一个模块中,也可以传递到另一个

表格/班级。


如果这个解释只是为了提出更多问题,请随便提出。 :-)


问候,

Fergus
Hi Genetic,

I''m guessing that you are trying to do those things from another Form. In
which case it <has> come up before and will again (and again!!)

Form1 in VB6 can be used to get at the instantiated Form. Form1.Visible is
the Visible property of the actual Form.

Form1 in VB.NET is the <class> from which instances of the form can
created. Form1 as an <object> no longer applies. Form1.Visible fails because
it is asking for the Visible property of the class, and the class doesn''t have
one - it is only availble to instances of the class.

If you want to access your ''Form1'' from a different Form, (or another
class, for that matter) you need to have a reference to the instance of that
Form1. This can be stored globally in a module or passed into the other
Form/class.

If this explanation only serves to raise more questions, ask away. :-)

Regards,
Fergus


也许你可以回答我的问题, Fergus?

不是意思,而是在某人的线索上,但它有点相关...


我建议

表格.Close()或...

Form.Hide()

Form.Dispose()


Form.Close( )是我教过的方法,我使用的是,但是,我已经运行了几个代码示例(由人们编写的知识比知识要多得多)我已经使用了Hide()> Dispose()方法。

区别是什么?

..

" Fergus Cooney" <音响****** @ tesco.net>在留言中写道

news:ep ************** @ TK2MSFTNGP10.phx.gbl ...
Maybe you can answer a question for me, Fergus?
Not meaning to but in on someone elses thread, but its kinda related ...

I suggested
Form.Close() or ...
Form.Hide()
Form.Dispose()

Form.Close() is the method I have been taught and that I use, however, I
have run across several code samples (written by people a hell of a lot more
knowledge than me) that have used the Hide() > Dispose() method.
Whats the difference?
..
"Fergus Cooney" <fi******@tesco.net> wrote in message
news:ep**************@TK2MSFTNGP10.phx.gbl...
Hi Genetic,

我猜你正试图从另一个表格中做这些事情。
在这种情况下它< has>之前会再次出现(并且会再次!!)

VB6中的Form1可用于获取实例化的Form。
Form1.Visible是实际Form的Visible属性。

VB.NET中的Form1是< class>可以从中创建表单的实例。 Form1作为<对象>不再适用。 Form1.Visible失败
,因为它要求类的Visible属性,并且类没有
有一个 - 它只适用于类的实例。

如果你想从另一个表格(或其他类别)访问你的''Form1',你需要引用Form1的
实例。这可以全局存储在一个模块中,也可以传递到另一个表格/类中。

如果这个解释只能提出更多问题,请随便提出。 :-)

问候,
Fergus
Hi Genetic,

I''m guessing that you are trying to do those things from another Form. In which case it <has> come up before and will again (and again!!)

Form1 in VB6 can be used to get at the instantiated Form. Form1.Visible is the Visible property of the actual Form.

Form1 in VB.NET is the <class> from which instances of the form can
created. Form1 as an <object> no longer applies. Form1.Visible fails because it is asking for the Visible property of the class, and the class doesn''t have one - it is only availble to instances of the class.

If you want to access your ''Form1'' from a different Form, (or another
class, for that matter) you need to have a reference to the instance of that Form1. This can be stored globally in a module or passed into the other
Form/class.

If this explanation only serves to raise more questions, ask away. :-)

Regards,
Fergus



这篇关于VB.NET和FORMS(Form.Show,Form.Hide ......)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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