存取资料 [英] access data

查看:60
本文介绍了存取资料的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何以其他形式访问控件的数据

how to access data of a control into other form

推荐答案

创建公共属性并以该形式保存对该控件的引用.

然后,您可以轻松地调用这些属性并以表格的形式获取控件的值.
Create public properties and hold a reference to that control in the form.

You can then easily call these properties and get the values of controls in the form.


我不记得它是否在VS 2003或2005中可用,但是如果您可以使用100确保在代码运行时第一个窗体将打开,您可以从第一个窗体访问控件,如下所示:

I can''t remember if this became available in VS 2003 or 2005, but if you can be 100% sure that the first form will be open when the code runs, you can access a control from the first form like this:

Dim strTextFromForm1 as String = My.Forms.Form1.txtTextboxOnForm1.Text


这篇关于存取资料的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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