在窗口应用程序中将值从一种形式发送到另一种形式 [英] Send value one form to another form in window Application

查看:86
本文介绍了在窗口应用程序中将值从一种形式发送到另一种形式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尊敬的先生,在窗口应用程序中如何从一种形式向另一种形式发送和检索值.以syntex为例.请帮助我...

Dear sir, How can send and retrieve value from one form to another form in window application. with syntex example. please help me...

推荐答案

一种形式(值的接收)需要一个公共属性.另一种形式(发送者)需要引用第一种形式.然后,在发件人中:

MyRefToReceive.MyProperty = MyValue;

如果您想要更具体的内容,那么您需要提出一个更具体的问题.
One form (the receive of the value) needs a public property. The other form (the sender) needs a reference to the first form. Then, in the sender:

MyRefToReceive.MyProperty = MyValue;

If you want anything more specific than that, then you need to ask a more specific question.


您好,

form1的A类,Class2的B类

在类B中创建属性
公共字符串输入
{
获取{重新运行输入;}
设置{value = input;}
}

然后使用类B的对象分配类A的值.

B obj = new B();
obj.Input =您的字符串";

在小学生B中,您可以获取此属性值

字符串x =输入;


这是未经验证的Plas试试.
问候,
shefeek
Hi,

class A for form1,Class B form2

create property in class B
public string Input
{
get{retrun input;}
set{value=input;}
}

then assign value from class A using the object of class B.

B obj=new B();
obj.Input="your string";

in calss B you can acess this propert value

string x=Input;


this is not verified plas try it.
regards,
shefeek


这篇关于在窗口应用程序中将值从一种形式发送到另一种形式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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