简体   繁体   English

C#RichTextBox搜索具有2种形式

[英]c# richtextbox search with 2 forms

I've build an email app in c# winforms with a richtextbox. 我已经在带有富文本框的c#winforms中构建了一个电子邮件应用程序。 Now I want to add a search option, which opens in a new Window to enter the search/replace text. 现在,我想添加一个搜索选项,该选项将在新窗口中打开以输入搜索/替换文本。 I know how to do this in one form, but how do i get access to the richtextbox in form1 from the second form? 我知道如何以一种形式执行此操作,但是如何从第二种形式访问form1中的richtextbox?

In short, to have a form return values, one must give it public properties, and have them set by the form when closing. 简而言之,要拥有表单返回值,必须给它提供公共属性,并在关闭时由表单设置它们。

A more in-depth explanation and examples can be found here 这里可以找到更深入的解释和示例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM