【发布时间】:2020-02-07 17:41:00
【问题描述】:
我最近一直在努力解决一个问题,该问题禁止我从左到右书写,而是从右到左书写。谁知道怎么解决?
string originalText;
private string replaceToStars(object sender)
{
if (sender == textBox3)
{
originalText = textBox3.Text;
string replaced = Regex.Replace(originalText, @"[a-z0-9A-Z]", "*");
textBox3.Text = replaced;
}
else if (sender == textBox3)
{
textBox3.Text = originalText;
}
return textBox3.Text;
}
【问题讨论】:
-
replaceToStars方法有什么相关性?此外,if和else if块中的两个条件都是相同的。 -
@Diado 这个方法的作用,实际上是用星号“*”替换“textbox3”中的给定文本,也是的,我对“else if”语句不好,但它似乎仍然没有工作中
-
你不能用
[TextBox].PasswordChar = '*'吗?设计器中有[TextBox].RightToLeft = Yes吗?
标签: c# .net regex windows winforms