vb.net表单应用程序 [英] vb.net forms application

查看:65
本文介绍了vb.net表单应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写一个vb.net表单应用程序。我从主表单的列表框中收集了一些信息

。然后我想在同一个应用程序中以另一种形式使用该列表框

arraylist。什么是获取该信息或列表框对象到下一个表单的最佳方式。


点击提交按钮后我想转到

newform.DefInstance.ShowDialog()我希望列表框在范围内可用




非常感谢;


Segue

I''m writing a vb.net forms application. I collect some information
in a listbox from the main form. Then I want to use that listbox
arraylist in another form on the same application. What''s the
best way to get that information or listbox object to the next form.

After a submit button click I want to go to
newform.DefInstance.ShowDialog() and I want the listbox to be
available, in scope.

Much Thanks;

Segue

推荐答案

你可以使用一个属性:
$ b $例如,在你要显示项目的第二个表单上,你添加了一个

属性:


公共属性myItems()如ListBox.ObjectCollection

获取

返回ListBox1.Items

结束获取

设置(ByVal值为ListBox.ObjectCollection)

ListBox1.Items.AddRange(超值)

结束集

结束物业


和第一张表格在那里你打电话给第二个表格你会做一些像这样的事情:
这个:


Dim frm2 As New Form2

frm2.myItems = ListBox1 .Items

frm2.Show()


hth Greetz Peter


-

今天的编程是软件工程师之间的竞赛努力建立更大,更好的防止白痴程序,并且宇宙试图生产更大更好的白痴。到目前为止,宇宙正在赢得胜利。 (Rich Cook)


" segue" < SE *** @ discussions.microsoft.com> schreef in bericht

新闻:2D ********************************** @ microsof t.com ...
Hi, you can use a property for that:
for example on the second form where you want to show the items, you add a
property:

Public Property myItems() As ListBox.ObjectCollection
Get
Return ListBox1.Items
End Get
Set(ByVal Value As ListBox.ObjectCollection)
ListBox1.Items.AddRange(Value)
End Set
End Property

and on the first form where you call the second form you do something like
this:

Dim frm2 As New Form2
frm2.myItems = ListBox1.Items
frm2.Show()

hth Greetz Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"segue" <se***@discussions.microsoft.com> schreef in bericht
news:2D**********************************@microsof t.com...
我正在写一个vb.net表单应用程序。我从主表单的列表框中收集了一些信息。然后我想在同一个应用程序中以另一种形式使用该列表框
arraylist。什么是将信息或列表框对象转换为下一个表单的最佳方式。

点击提交按钮后我想转到
newform.DefInstance.ShowDialog ()我希望列表框在范围内可用。

非常感谢;

Segue
I''m writing a vb.net forms application. I collect some information
in a listbox from the main form. Then I want to use that listbox
arraylist in another form on the same application. What''s the
best way to get that information or listbox object to the next form.

After a submit button click I want to go to
newform.DefInstance.ShowDialog() and I want the listbox to be
available, in scope.

Much Thanks;

Segue



Seque,


您一次只能激活一个表单。

传递给showdialog表单通常是以


\\\

dim frm2 as new form2

dim frm2.HisArraylist = myarraylist

frm2.showdialog

frm2.dispose

///


我希望这会有所帮助,

Cor
Seque,

You have only one form active in a time.
Passing to a showdialog form is commonly done as

\\\
dim frm2 as new form2
dim frm2.HisArraylist = myarraylist
frm2.showdialog
frm2.dispose
///

I hope this helps,

Cor


我最终使用了这个解决方案。


谢谢。

问候;


Segue


" Peter Proost"写道:
I ended up using this solution.

Thank You.

Regards;

Segue

"Peter Proost" wrote:
你可以使用一个属性:
例如在你要显示项目的第二个表单上,你添加了一个
属性:公共属性myItems()如ListBox.ObjectCollection
获取
返回ListBox1.Items
结束获取
设置(ByVal值为ListBox.ObjectCollection)
ListBox1.Items.AddRange(超值)
结束集
结束属性

在你打电话给第二个表单的第一个表单上你做了类似的事情>这个:

Dim frm2 As New Form2
frm2.myItems = ListBox1.Items
frm2.Show()

ht Greetz Peter
-
今天的编程是软件工程师之间的竞赛,他们正在努力建立更大,更好的防止白痴的程序,并且宇宙试图产生更大更好的白痴。到目前为止,宇宙正在赢得胜利。 (Rich Cook)

segue < SE *** @ discussions.microsoft.com> schreef in bericht
新闻:2D ********************************** @ microsof t.com。 ..
Hi, you can use a property for that:
for example on the second form where you want to show the items, you add a
property:

Public Property myItems() As ListBox.ObjectCollection
Get
Return ListBox1.Items
End Get
Set(ByVal Value As ListBox.ObjectCollection)
ListBox1.Items.AddRange(Value)
End Set
End Property

and on the first form where you call the second form you do something like
this:

Dim frm2 As New Form2
frm2.myItems = ListBox1.Items
frm2.Show()

hth Greetz Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"segue" <se***@discussions.microsoft.com> schreef in bericht
news:2D**********************************@microsof t.com...
我正在写一个vb.net表单应用程序。我从主表单的列表框中收集了一些信息。然后我想在同一个应用程序中以另一种形式使用该列表框
arraylist。什么是将信息或列表框对象转换为下一个表单的最佳方式。

点击提交按钮后我想转到
newform.DefInstance.ShowDialog ()我希望列表框在范围内可用。

非常感谢;

Segue
I''m writing a vb.net forms application. I collect some information
in a listbox from the main form. Then I want to use that listbox
arraylist in another form on the same application. What''s the
best way to get that information or listbox object to the next form.

After a submit button click I want to go to
newform.DefInstance.ShowDialog() and I want the listbox to be
available, in scope.

Much Thanks;

Segue




这篇关于vb.net表单应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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