WP7 有句C#代码,要如何换成VB写法? 高手,救命啊!
//构造WCF代理对象
ServiceReference1.Service1Client proxy = new ServiceReference1.Service1Client();
//设置代理返回结果后的处理事件
proxy.checkUserCompleted += new EventHandler<ServiceReference1.checkUserCompletedEventArgs>(_proxy_WriteResult);
//开始异步调用WCF服务
proxy.checkUserAsync(txtUserId.Text.Trim(), txtPassword.Password.Trim());
}
private void _proxy_WriteResult(object sender, ServiceReference1.checkUserCompletedEventArgs e)
{
switch(e.Result.ToString()){
case "0":
lbl_error.Text = "验证正确";
break;
case "1":
lbl_error.Text = "用户名错误";
break;
}
}
以上C#代码,请问VB.NET代码要如何写??
尤其是
proxy.checkUserCompleted += new EventHandler<ServiceReference1.checkUserCompletedEventArgs>(_proxy_WriteResult);
这句 Windows?Phone?7 C# VB WCF?
[解决办法]
google VB.NET AddHandler AddressOf
[解决办法]
'构造WCF代理对象
Private proxy As New ServiceReference1.Service1Client()
'设置代理返回结果后的处理事件
Private proxy.checkUserCompleted += New EventHandler(Of ServiceReference1.checkUserCompletedEventArgs)(AddressOf _proxy_WriteResult)
'开始异步调用WCF服务
proxy.checkUserAsync(txtUserId.Text.Trim(), txtPassword.Password.Trim())
private void _proxy_WriteResult(Object sender,ServiceReference1.checkUserCompletedEventArgs e)
Select Case e.Result.ToString()
Case "0"
lbl_error.Text = "验证正确"
Case "1"
lbl_error.Text = "用户名错误"
End Select