设置文本框的值 [英] Set value of Textbox

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

问题描述

这是针对Winform的。


将文本发送到另一种形式的文本框的代码是什么?在我的搜索

表单中,当用户单击OK时,我想将一个字符串发送到

frmDataEntry中的文本框。我下面的代码不起作用。


private void cmdOk_Click(object sender,System.EventArgs e)

{

frmDataEntry f = new frmDataEntry();

f.txtDealerInfo.Text =" test1";


this.DialogResult = DialogResult.OK;

}

This is for a Winform.

What is the code to send text to a text box in another form? In my search
form when the user click OK, I want to sent a string to a text box in
frmDataEntry. The code I have below does not work.

private void cmdOk_Click(object sender, System.EventArgs e)
{
frmDataEntry f = new frmDataEntry();
f.txtDealerInfo.Text = "test1";

this.DialogResult = DialogResult.OK;
}

推荐答案

这是一个如何使用

Server在表单之间传递变量的简单示例。转移和其他机制:
http://www.dotnetbips.com/disp layarticle.aspx?id = 79

我希望这对你有帮助。


此致,

Bobby

Here is a simple example of how to pass variables between forms using
Server.Transfer and other mechanisms:
http://www.dotnetbips.com/disp layarticle.aspx?id=79

I hope this was helpful.

Sincerely,
Bobby


这篇关于设置文本框的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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