사용자가 입력 할 TextBox가 하나 있습니다.TextBox에서 하이픈을 두 자리 뒤에 자동으로 삽입하는 방법은 무엇입니까?
텍스트 상자에 사용자 입력은 형식은 내가 삽입 할이
01-22-34-40-33
처럼해야 할 때 "-"를 2 자리 숫자 후 TextChanged 이벤트 핸들러. 그들은 심지어 경우
if(txtRandomThirdTypeSales.Text.Length == 2)
{
txtRandomThirdTypeSales.Text += "-";
}
else if (txtRandomThirdTypeSales.Text.Length == 5)
{
txtRandomThirdTypeSales.Text += "-";
}
else if (txtRandomThirdTypeSales.Text.Length == 8)
{
txtRandomThirdTypeSales.Text += "-";
}
else if (txtRandomThirdTypeSales.Text.Length == 11)
{
txtRandomThirdTypeSales.Text += "-";
}
"작동하지 않음"이란 무엇을 의미합니까? 무슨 일이 일어나고 있는지 알기 위해 몇 가지 중점을 뒀습니까? – RezaRahmati
내 말은, 조건이 무엇보다 더 많은 것이 있다면 기능이 없다는 것입니다! –
내 대답을 시도하고 상태를 공유하십시오 – Sumeshk