将单个表单用于多个任务 [英] Using single Form for multiple task

查看:42
本文介绍了将单个表单用于多个任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有多个带有查找"按钮的表格.我所拥有的表单是Contacts.vb和Users.vb,我想对这两种表单都使用单个Find.vb表单.我的意思是用户应该按下Contacts.vb还是Users.vb中的查找"按钮,应该使用从数据库中获取的相应数据打开相同的表单.

我尝试使用Users.vb中的Find.Owner = Me,但是我不知道如何从Find.vb中确定谁是所有者.

我尝试使用以下方式:如果查找表单的所有者是Users.vb,则从用户表中获取数据;如果所有者是Contacts.vb,则从联系人表中获取数据.
不幸的是,我无法执行此任务.

请提供任何适当的解决方案或任何其他建议来执行此操作.
在Advance中感谢

I am having multiple forms with Find button provided. The forms i am having are Contacts.vb and Users.vb, i want to use single Find.vb form for both of these forms. I mean whether a user presses Find button from Contacts.vb or Users.vb the same form should be opened with corresponding data that is fetched from database.

I tried using Find.Owner = Me from Users.vb but i don''t know how can i determine from Find.vb that who is the owner.

I tried to use that if owner of find form is Users.vb then fetch data from users table and if owner is Contacts.vb then fetch data from Contacts table.
Unfortunately i am not able to perform this task.

Please provide any proper solution or any other suggestion to perform this.
Thanks in Advance

推荐答案

尽管有很多方法,但是由于您无法想到执行此操作的任何逻辑,因此我将为您提供一个非常简单的逻辑. />
创建您的查找表单say(Find.vb)

创建2个属性,一个用于查询,另一个用于Returnedvalue.

在您的查找表中
1.使用查询属性中的值填充数据.
2.选择后,设置带有斜线值的Returnedvalue属性.
3.然后不要删除表单,而只是隐藏表单.

单击查找"按钮后,在联系人/用户"表单中
1.创建查找表单对象.
2.使用relevent query设置Query属性以填充数据.
3.将表单显示为对话框.
4.从查找"表单对象的Returnedvalue参数中获取选定的值.
5.处置查找表.

就是这样.

现在您需要编码.
Though there are so many ways, because of you cannot think of any logic to do it, I will give you a very simple logic.

Create your Find form say(Find.vb)

Create 2 properties, one for Query and one for the Returnedvalue.

In your find form
1. Populate your data using the value in the Query Property.
2. After selection set Returnedvalue property with the seloected value.
3. Then dont drop the form just hide the form.

In your Contacts/Users form after clicking on the find button
1. Create the Find form object.
2. Set the Query Property with relevent query to populate data.
3. Show the form as dialogue.
4. Get the selected value from the Returnedvalue parameter of the Find form object.
5. Dispose the find form.

Thats all.

Now you need to code.


这篇关于将单个表单用于多个任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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