将数据从一种形式加载到另一种形式 [英] load data from one form to another

查看:88
本文介绍了将数据从一种形式加载到另一种形式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个运行良好的Web应用程序.我在每个页面上都有以下控件/按钮;添加记录,编辑记录,搜索记录,删除记录.所有的按钮都可以正常工作.

现在,我决定添加一个搜索页面(登录页面),在该页面中必须检查记录是否存在.必须从下拉列表中选择年份并输入EmployNumber.如果该员工存在,则应在页面下方的文本框中显示其姓氏,姓氏,部门,位置.如果未输入该年份的其他记录,则应能够单击表单上的添加记录按钮并直接转到其他表单,您可以在不输入他的姓名和雇员编号的情况下为他添加数据.这对于编辑按钮应该是相同的.我想在搜索页面上进行一次搜索而不是在每个页面上

示例代码会使我做得更好.
1.在主表单上声明一个全局变量,该变量可以从子表单中更新.

2.使用临时文件保存并重新读取数据...并非最佳方法.

3.使用Windows注册表.

上面的选项1是您最好的选择.

网上有很多关于如何执行#1的示例.


很抱歉,我试图为您提供一些建议,以帮助您完成工作...我有5分钟的时间从事项目工作之间,却无法找出哪一个对我最合适.

过去起作用的一件事是从子窗体中调用MAIN窗体上的函数,并将变量或变量集传递给已更改的例程,然后获取已更新的变量详细信息,然后在主窗体中的例程中对其进行更新.


i have a web application which is working perfectly fine. i have the following controls/buttons on each page; add record,edit record,search record,delete record. all the buttons works perfectly.

Now i have decided to add a search page(the landing page) where one has to check for existence of the record. one has to select the year(from dropdown) and enter an EmployNumber.if the employee exist it should display his firstname,surname,department,location in the textboxes below the page.if his other records for that year are not entered,one should be able to click add record button on the form and direct to other forms where you can add data for him without entering his name and employnumber for him.This should be the same for edit button.i want searching to be done once on search page rather than on each page

sample code will do me better

解决方案

There are many ways to do it:

1. Declare a Global Variable on the Main Form which can be updated from the Child Form.

2. Use a temporary file to save and re-read the data... Not the best way.

3. Use the Windows Registry.

Option 1 above would be your best bet.

There are plenty of examples on how to do #1 on the web.


Sorry but I was trying to be helpful on giving you ideas how to get it done... I had 5 minutes between working on projects and wasn''t able to look up which one worked best for me.

One thing that worked in the past was to call a function on the MAIN Form from the Child Form and pass a variable or set of variables to a routine of what changed then take the updated variable details then update them in the routine in the main form.


这篇关于将数据从一种形式加载到另一种形式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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