Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
任何人都知道如何在文本框中有 160 个或更多字符时将标签增加到 2(或更多)条消息?
创建一个事件来更改文本框中的文本,计算那里的字符数。然后检查所需字符是否达到限制,并增加标签文本值,如下所示,
private void txtSearchMember_TextChanged(object sender, EventArgs e) { if (txtSearchMember.Text.Length >= 160) { lblMessageCount.Text = 1; // Increase count with simple maths } }