private void textBox1_TextChanged(object sender, System.EventArgs e)
{ string temp=this.textBox1.Text ;
if(temp.Length >2)
{
if(temp.Substring(temp.Length-3,2)==@"\n")
{
temp.Remove (temp.Length -3,2);
temp+="\n";
this.textBox1 .Text =temp;
}
}
}
你可以用类似方法做个switch case
{ string temp=this.textBox1.Text ;
if(temp.Length >2)
{
if(temp.Substring(temp.Length-3,2)==@"\n")
{
temp.Remove (temp.Length -3,2);
temp+="\n";
this.textBox1 .Text =temp;
}
}
}
你可以用类似方法做个switch case
解决方案 »
- C# web 如何实现在IE中打开word 或者是Excel
- winform里如何设置下拉框的默认选项?
- WebRequest 的Timeout的设置问题
- 用c#+AE做数据入库,数据库是Oracle10G,要怎么做?
- C#开发教师教学成绩评估系统遇到的问题
- C#事件中不使用EVENT关键字,效果为什么一样?
- C#中有没有信号处理机制?
- 请问哪位知道如何将TextBox中文字的垂直方向设置为居中(WinForm中)?
- 两个项目合二为一问题
- 窗体
- 用RegularExpressionValidator控件和正则表达式验证textbox的内容怎么不行?
- 这个DataTable的Select的查询语句怎么写?
ms-help://MS.MSDNQTR.2003FEB.2052/dnmag02/html/NETSerialComm.htm
string str = m.ToString();
string val = str.Substring(2);
int i = System.Convert.ToInt32(val, 16);
return ((char)i).ToString();
}private void button1_Click(object sender, System.EventArgs e) {
string s1 = @"a\nb\x63d"; //is you textbox.text
string s2;
s2 = Regex.Replace(s1, @"\\n", "\n");
s2 = Regex.Replace(s2, @"\\x\d{2}", new MatchEvaluator(RepX)); MessageBox.Show(s2);
}