如何仅从 TextBox 获取新文本? [英] How to get only NEW text from TextBox?
本文介绍了如何仅从 TextBox 获取新文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
private void tbLog_TextChanged(object sender, TextChangedEventArgs e)
{
//Get only NEW text added to Log
}
/*
LOG
old message...
old message...
old message...
old message...
NEW message...
NEW message...
NEW message...
NEW message...
NEW message...
*/
如何只从文本框中获取新文本?
How to I get only NEW text from the TextBox?
推荐答案
类似的事情?
private string old_text = "";
private void tbLog_TextChanged(object sender, TextChangedEventArgs e)
{
if(old_text != tbLog.Text)
{
writeLog(tbLog.Text);
old_text = tbLog.Text;
}
}
这篇关于如何仅从 TextBox 获取新文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文