首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

求VB代码转换成C#该如何处理

2012-12-27 
求VB代码转换成C#Private Sub UseNoTextBox_KeyPress(ByVal sender As Object, ByVal e As System.Windows

求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" 试试  你要设置断点自己调试下才行啊

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

热点排行