VB列表框以乘法形式显示? [英] Vb listbox display in multiply forms?

查看:109
本文介绍了VB列表框以乘法形式显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用VB.Net和Visual Studio 2012.

I'm using VB.Net and Visual Studio 2012.

我需要以两种不同的形式显示相同的列表框.

I need to display the same list box in two different forms.

场景

我正在创建一个程序,允许其用户在咖啡馆中创建订单.当用户完成他们的订单时,他们按下保存/完成"按钮.当他们按下此按钮时,他们的订单将添加到新订单窗体侧面的列表框中.

I'm creating a program that allows its users to create orders in a cafe. When the user has completed their order they press the button "save/ complete". When they press this button their order is added to a listbox on the side of the new order form.

在另一种形式(摘要)上,将显示相同的列表框.

On the other form (summary), there will be the same listbox displayed.

所以我的问题是如何在多个表单上显示相同的列表框?

So my question is how to display the same listbox on multiple forms?

推荐答案

您可以通过将组合项保存到文本文件中来做到这一点,以使其他表单可以读取同一文件?我认为不是那么专业,但这是一种选择:)

You can do this maybe by saving the combo items to a textfile, that the other form can read the same file? I think it's not that professional, but it is an option :)

创建.txt文件的示例- http://www.homeandlearn.co.uk /NET/nets8p4.html

Example creating a .txt file - http://www.homeandlearn.co.uk/NET/nets8p4.html

将.txt文件读入控件的示例-

Example reading a .txt file into a control - https://msdn.microsoft.com/en-us/library/db5x7c0d(v=vs.110).aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1

读取文本文件并将其放置在控件中需要在MyBase.Load事件中.

The reading of the text file and placing it in the control need to be in the MyBase.Load event.

希望我能对您有所帮助!

Hopefully I helped you a little bit!

这篇关于VB列表框以乘法形式显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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