这是我的代码;
public void Dönüştür()
{
int TextboxLength = TextBox.MaxLength;
string LowerText = TextBox.Text.ToLower();
var AllCharacters = "";
for (int i = 0; i < TextboxLength; i++)
{
char Characters = char.Parse(LowerText);
switch (Characters)
{
case '0': AllCharacters += "0"; break;
case '1': AllCharacters += "1"; break;
case '2': AllCharacters += "2"; break;
case '3': AllCharacters += "3"; break;
case '4': AllCharacters += "4"; break;
case '5': AllCharacters += "5"; break;
case '6': AllCharacters += "6"; break;
case '7': AllCharacters += "7"; break;
case '8': AllCharacters += "8"; break;
case '9': AllCharacters += "9"; break;
case ' ': case '+': case '-': case '_': AllCharacters += "0"; break;
case ':': case ';': case '=': case ',': case '.': AllCharacters += "1"; break;
case 'a': case 'b': case 'c': case 'ç': AllCharacters += "2"; break;
case 'd': case 'e': case 'f': AllCharacters += "3"; break;
case 'g': case 'ğ': case 'h': case 'ı': case 'i': AllCharacters += "4"; break;
case 'j': case 'k': case 'l': AllCharacters += "5"; break;
case 'm': case 'n': case 'o': case 'ö': AllCharacters += "6"; break;
case 'p': case 'r': case 's': case 'ş': AllCharacters += "7"; break;
case 't': case 'u': case 'ü': AllCharacters += "8"; break;
case 'v': case 'y': case 'z': case 'x': case 'w': AllCharacters += "9"; break;
}
}
MessageBox.Show(TextBox.MaxLength.ToString(), "TextBox MaxLength:");
MessageBox.Show(AllCharacters.ToString(), "AllCharacters value:");
}
我想将数字转换为字母。char 值,但它似乎为空。
如果选中,则填充 TextBox,尽管 for 循环不起作用。造成这种情况的原因可能是 0 TextBox 的字符数但 TextBox 已填充。
问题是什么,我在哪里犯错?