将文本字符串从一个表单传递到另一个表单 [英] Passing Text String From One Form To Another Form

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

问题描述

您好,



我希望能够将文本字符串从一个表单上的文本框传递到另一个表单上的文本框。所以基本上textbox1(formA)到textbox1(FormB)。是否有一种简单的方法可以实现这一目标。



任何帮助都会很棒....我确实有代码的位,它并不总是有用。 />


Cheeeers

Hi There,

I want to be able to pass text string from a textbox on One form to textbox on another form. So basically textbox1 (formA) to textbox1 (FormB). Is there a simple method for this to be achieved.

Any help would be great....i do have abit of code bit it doesnt always work.

Cheeeers

推荐答案

看看这个:



http://www.daniweb.com/software-development/vbnet/threads/43763 [ ^ ]



希望它有所帮助:)
check this out:

http://www.daniweb.com/software-development/vbnet/threads/43763[^]

hope it helps :)


最简单的在这里



如果你想要从FormA获取textString到FormB

然后首先将textBoxes的Modifiers属性设置为Friend。

并试试这个。

在Form Load事件下of FormB

The Simplest Is Here

If You want to get textString from FormA to FormB
then First make the Modifiers property of textBoxes to Friend .
And Try this.
Under Form Load event of FormB
textBox1.text = FormA.textBox1.text



您可以通过声明任何值获得价值字符串也。

但你必须隐藏或发送回您的FormA。

它将无法工作如果你关闭FormA。

所以在你的关闭按钮代码下隐藏表格。



这可以帮助你


you Can Get the Value by Declaring any String also.
But You must Hide or Send to Back your FormA.
It will not work If you Close the FormA.
So under your Close Button Code there to hide the form.

may this Can help you


由于这个问题非常受欢迎,我以前的答案往往不太清楚,可能还不清楚够了,我决定写一篇提示/技巧文章,附上详细的代码示例和解释:



-SA
As the question turned out to be very popular, and my previous answers often were not well understood, probably were not clear enough, I decided to write a Tips/Trick article complete with detailed code samples and explanations: Many Questions Answered at Once — Collaboration between Windows Forms or WPF Windows.

—SA


这篇关于将文本字符串从一个表单传递到另一个表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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