b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

c控件rutltextbox_richtextbox 控件_c richtextbox回车(11)

电脑杂谈  发布时间:2017-01-31 04:20:06  来源:网络整理

}

}

在 RichTextBox 的内容内搜索文本:

重载列表

在 RichTextBox 控件的文本中搜索字符列表中某个字符的第一个实例

[C#] public int Find(char[]);

示例

[Visual Basic, C#, C++] 下面的示例在 RichTextBox 的内容中搜索在 text 参数中传递到方法的字符。如果在 RichTextBox 中找到了 text 数组的内容,则该方法返回所找到值的索引;否则,它将返回 -1。该示例假定此方法位于 Form 的类中,该窗体包含一个名为 richTextBox1 的 RichTextBox 控件和一个连接到该示例中定义的单击事件处理方法的 Button 控件(名为 button1)。

[C#]

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

{

MessageBox.Show(FindMyText(new char[]{'D','e','l','t','a'}).ToString());

}

public int FindMyText(char[] text)

{

// Initialize the return value to false by default.

int returnValue = -1;

// Ensure that a search string has been specified and a valid start point.

if (text.Length > 0)

{

// Obtain the location of the first character found in the control

// that matches any of the characters in the char array.

int indexToText = richTextBox1.Find(text);

// Determine whether the text was found in richTextBox1.

if(indexToText >= 0)

{


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-29694-11.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    • 代梦莹
      代梦莹

      感觉是美国品牌评选

    • 张瑛
      张瑛

      按现有利率算放银行一年死期也就200块钱吧

    热点图片
    拼命载入中...