日期:2014-05-17  浏览次数:21126 次

求VB代码转换成C#

    Private Sub UseNoTextBox_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles UseNoTextBox.KeyPress
        If Asc(e.KeyChar) = 13 Then
            e.Handled = True
            PasswordTextBox.Focus()
            PasswordTextBox.SelectAll()
        End If
    End Sub


使用下面的自动转换不行啊
http://www.developerfusion.com/tools/convert/vb-to-csharp/?batchId=c2fdae36-9987-4e84-bfd7-40f19f242c74


private void UseNoTextBox_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if (Strings.Asc(e.KeyChar) == 13) {
e.Handled = true;
PasswordTextBox.Focus();
PasswordTextBox.SelectAll();
}
}

------最佳解决方案--------------------

 if (e.KeyVal == 13)
 {         e.Handled = true;
         PasswordTextBox.Focus();       
  PasswordTextBox.SelectAll();     


改成这样
------其他解决方案--------------------
网上自动转化一大堆呀~~~
------其他解决方案--------------------
LZ不是都转换好了么
------其他解决方案--------------------
运行不好用ya 
------其他解决方案--------------------
e.KeyVal,不可用啊
------其他解决方案--------------------
(Strings.Asc(e.KeyChar))==“13" 试试  你要设置断点自己调试下才行啊

要不就是你就这样粘贴进去,连事件都没有关联了