字母数字密码

扫码查看
本文介绍了字母数字密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想限制我的用户仅输入字母数字密码才能打开我的应用程序.请提供相同的C#代码或算法.

I want to restrict my user to strictly input alphanumeric password only to open my application. Please provide c# code or algorithm for the same.

推荐答案

private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
// Allows only Alpha-Numeric’s
if (!(Char.IsLetter(e.KeyChar) || Char.IsDigit(e.KeyChar) || Char.IsControl (e.KeyChar)))
e.Handled = true;
}




这篇关于字母数字密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-18 04:11
查看更多