如何将值从一种形式传递到另一种形式 [英] How to pass values from one form to another form

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

问题描述

朋友,
在我的项目中有很多表格.我想如何将值从一个表格传递到另一表格.在我的第一个表格中,我在该表格中输入了所有详细信息.查找按钮.表单1组合框是否存在,我输入了先前的记录,该组合框中将显示一条记录.现在,我单击selectitem仅显示特定记录.请解决我的问题


谢谢&问候

Hi Friend,
In my project so many forms are there.I want how to pass values from one form to another form.In my first form i entered all details in that form find button is there.If i click find button another form will be open in that form 1 combobox is there i entered previous records one record will be display in that combobox.Now i click the selectitem particular records only display.Please solve my problem


Thanks & Regards

推荐答案

在您的情况下,最好的方法是使用仅采用适当参数的Form2构造函数(因为在使用之前需要显示数据) ,这很有意义),也可以在Form2中设置公共属性,并在构造实例时以及使用Show或ShowDialog方法之前使用适当的值进行设置.
The best way in your situation is either to use a Form2 constructor which takes only the appropriate parameters (since it needs the data to display before it can be used, this makes sense) or to set up public properties in Form2 which you set with the appropriate values when you construct the instance, and before you use the Show or ShowDialog methods.


Hello Hari
您可以使用QueryString参数将值从一种形式传递到另一种形式.此外,如果要在应用程序级别/会话级别包含该值,请使用Session []或Global.asax.

快乐编程:)
Hello Hari
you can use QueryString params to pass values from one form to another.And also if you want to contain that value at Application level / Session level go for Session[] or Global.asax.

Happy Programming :)


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

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