在文本框中用另一个(,)更改键盘输入(。) [英] Changing a keyboard entry (.) by another (,) in a textbox

查看:79
本文介绍了在文本框中用另一个(,)更改键盘输入(。)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

 我想在文本框控件中输入禁用字符时进行自动更改...我的数据库只接受逗号分隔符以获取金钱和美分条目。所以,每当
我按下键盘上的点时,我想自动更改此字段中逗号的点。非常感谢你的帮助。

 I want to make an automated change when I enter a forbidden character in a textbox control... My database accepts only a comma separator for money and cents entries. So, I would like to change the dot for a comma in this field automatically whenever I press the dot on my keyboard. Many thanks for your help.

推荐答案





请处理"KeyPress"在TextBox中输入事件,如果按下[。](句点)键,请将其替换为[,](逗号)。 



[VB。 NET]

Hi,

Please handle "KeyPress" event in TextBox, and if [.] (period) key is pressed, replace it with [,] (comma). 

[VB.NET]
Private Sub TextBox1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles TextBox1.KeyPress
	If (e.KeyChar = ".") Then
		e.KeyChar = ","
	End If
End Sub


[C#]

[C#]

private void TextBox1_KeyPress(object sender, KeyPressEventArgs e)
{
    if ((e.KeyChar == "."))
    {
        e.KeyChar = ",";
    }
}




问候,


Regards,


这篇关于在文本框中用另一个(,)更改键盘输入(。)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆