昏暗的测试作为新的形式1 [英] dim test as new form1

查看:85
本文介绍了昏暗的测试作为新的形式1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


i有一个设定形式(form4)


此表单从mdi父窗体打开1

我想要做的是,当我在form4中进行更改(调整设置),然后在mdi父form1中的一个

列表视图重新启动,这就是我所做的。


公共类Form4


继承System.Windows.Forms.Form


Dim windowmain As New Form1()


Private Sub Button1_Click(ByVal sender As System.Object,ByVal e As

System.EventArgs)处理Button1.Click


Next inti


otherwindow.listsetup()


Me.close


End Sub


现在的问题是,当我尝试打开form4时,我得到了所有

组件的错误


对象引用未设置为对象的实例。

form1,我认为因为我将表单声明为新表单。


我能做什么与form1沟通


问候,


Maarten


hi all,

i have a settingform(form4)

this form opens from an mdi parent form1
what i want do do is, when i make change in form4 (adjust settings), then a
listview in the mdi parent form1 refreches, this is what i did.

Public Class Form4

Inherits System.Windows.Forms.Form

Dim windowmain As New Form1()

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Next inti

otherwindow.listsetup()

Me.close

End Sub

now the problem is, when i try to open form4 i get an error by all of the
components of

" Object reference not set to an instance of an object."
form1, i think becouse i declare the form as a new form1.

what can i do to comunicate with form1

Regards,

Maarten


推荐答案

Maarten,


在我看来,简单的方法就是你可以永远地从你的工作中获得支付
me.parentform .mdichildren收藏


在你的form4中有这样的东西,这是一个非常改变的文本在这个

的消息所以看看错别字

\\ \\\\

For Each frm As Form In Me.ParentForm.MdiChildren

如果frm.Name =" frm1"然后

DirectCast(frm,form1)。随便= text.Text

退出Sub

结束如果

下一步

///

我希望这有帮助吗?


Cor


" ;马腾" < gu ****** @ hotmail.com>>

大家好,
Maarten,

The simple way is in my opinion that you can work forever from your
me.parentform.mdichildren collection

Something as this in your form4 which is very much changed text in this
message so watch typos
\\\
For Each frm As Form In Me.ParentForm.MdiChildren
If frm.Name = "frm1" Then
DirectCast(frm, form1).Whatever = text.Text
Exit Sub
End If
Next
///
I hope this helps?

Cor

"Maarten" <gu******@hotmail.com>>
hi all,

我有一个设定形式(form4)

这个表单从一个mdi父窗体打开1
我想要做的是,当我在form4中进行更改(调整设置),然后在mdi父窗体1中的listview refreches,这是我做了什么。

Public Class Form4

继承System.Windows.Forms.Form

Dim windowmain As New Form1()

Private Sub Button1_Click(ByVal sender As System.Object,ByVal e As
System.EventArgs)处理Button1.Click

下一个inti

otherwindow。 listsetup()

Me.close

结束Sub

现在的问题是,当我尝试打开form4时,我得到了一个错误

的组成部分对象引用未设置为对象的实例。
form1,我认为因为我将表单声明为新表单。

我可以做什么来与form1进行通信

问候,

Maarten

i have a settingform(form4)

this form opens from an mdi parent form1
what i want do do is, when i make change in form4 (adjust settings), then
a listview in the mdi parent form1 refreches, this is what i did.

Public Class Form4

Inherits System.Windows.Forms.Form

Dim windowmain As New Form1()

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Next inti

otherwindow.listsetup()

Me.close

End Sub

now the problem is, when i try to open form4 i get an error by all of the
components of

" Object reference not set to an instance of an object."
form1, i think becouse i declare the form as a new form1.

what can i do to comunicate with form1

Regards,

Maarten



感谢您的回复

但是我通过AS得到错误(语法错误)。 in For Each frm As Form in

Me.ParentForm.MdiChildren。


但我觉得它更简单,如果我从中得到数据

如果关注parrentform会形成一个孩子吗?


但我将如何做到这一点?

我们欢迎提出建议。


亲切的问候Maarten。


" Cor Ligthert" <无************ @ planet.nl>在消息中写道

news:%2 **************** @ TK2MSFTNGP10.phx.gbl ...
thanks for the reply

but i get an error ( syntax error) by "AS" in For Each frm As Form In
Me.ParentForm.MdiChildren.

but i was thinking that it meightbe more simple, if i get the data from the
childform when the parrentform is focussed?

but how wil i do this?
anny suggestions are welcome.

kind regards Maarten.

"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Maarten,

在我看来,简单的方法是你可以永远地从你的
me.parentform.mdichildren集合中继续工作

在你的form4中这样的东西非常多更改了此消息中的文字,以便观看错别字
\\\
每个frm作为表单在Me.ParentForm.MdiChildren
如果frm.Name =" frm1"然后
DirectCast(frm,form1)。随便= text.Text
退出Sub
结束如果
下一页
///
我希望这有帮助吗?

Corart / Maarten" < gu ****** @ hotmail.com>>
大家好,
Maarten,

The simple way is in my opinion that you can work forever from your
me.parentform.mdichildren collection

Something as this in your form4 which is very much changed text in this
message so watch typos
\\\
For Each frm As Form In Me.ParentForm.MdiChildren
If frm.Name = "frm1" Then
DirectCast(frm, form1).Whatever = text.Text
Exit Sub
End If
Next
///
I hope this helps?

Cor

"Maarten" <gu******@hotmail.com>>
hi all,

我有一个设定形式(form4)

这个表单从一个mdi父窗体打开1
我想要做的是,当我在form4中进行更改(调整设置),然后在mdi父窗体1中的listview refreches,这就是我所做的。

Public Class Form4

继承System.Windows.Forms.Form

Dim windowmain为新Form1()

Private Sub Button1_Click(ByVal sender As System.Object,ByVal e As
System.EventArgs)处理Button1.Click

next inti

otherwindow.listsetup()

Me.close

结束Sub

现在的问题是,当我尝试打开form4时,我得到了所有的错误


的组成部分对象引用未设置为对象的实例。
form1,我认为因为我将表单声明为新表单。

我可以做什么来与form1进行通信

问候,

Maarten

i have a settingform(form4)

this form opens from an mdi parent form1
what i want do do is, when i make change in form4 (adjust settings), then
a listview in the mdi parent form1 refreches, this is what i did.

Public Class Form4

Inherits System.Windows.Forms.Form

Dim windowmain As New Form1()

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Next inti

otherwindow.listsetup()

Me.close

End Sub

now the problem is, when i try to open form4 i get an error by all of the
components of

" Object reference not set to an instance of an object."
form1, i think becouse i declare the form as a new form1.

what can i do to comunicate with form1

Regards,

Maarten




" Maarten" ; <顾****** @ hotmail.com> schrieb:
"Maarten" <gu******@hotmail.com> schrieb:
但是我得到了AS的错误(语法错误)。 in For Each frm As Form In
Me.ParentForm.MdiChildren。
but i get an error ( syntax error) by "AS" in For Each frm As Form In
Me.ParentForm.MdiChildren.




我假设您使用的是VB.NET 2002:

\\\

Dim f As Form

For Each f In Me.MdiChildren

... < br $>
下一页f

///


-

MS Herfried K. Wagner
MVP< URL:http://dotnet.mvps.org/>

VB< URL:http://dotnet.mvps.org/dotnet/faqs/> ;



I assume you are using VB.NET 2002:

\\\
Dim f As Form
For Each f In Me.MdiChildren
...
Next f
///

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


这篇关于昏暗的测试作为新的形式1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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