读书人

C#表达式转VB.Net,该如何处理

发布时间: 2013-04-20 19:43:01 作者: rapoo

C#表达式转VB.Net
如题 将以下代码转换成vb.net

private int col = -1;

Point location = col == 0 ? new Point(0, rect.top) : new Point( rect.left, rect.top);


通过 developerfusion Convert C# to VB.NET转换成Dim location As Point = If(col = 0, New Point(0, rect.top), New Point(rect.left, rect.top))是错误的

Me.textBox.Leave += New EventHandler(textBox_Leave)
“Public Event Leave(sender As Object, e As System.EventArgs)”是事件,不能直接调用。请使用“RaiseEvent”语句引发事件。

这个错误怎么解决呀

求大侠帮忙
VB.NET
[解决办法]

 Private col As Integer = -1

Dim location As Point = IIf(col = 0, New Point(0, rect.top), New Point(rect.left, rect.top))

[解决办法]
 AddHandler Me.textBox.Leave, AddressOf textBox_Leave

[解决办法]

Dim location As Point = CType(IIf(col = 0, New Point(0, rect.top), New Point(rect.left, rect.top)), Point)

AddHandler Me.textBox.Leave, AddressOf textBox_Leave

读书人网 >VB Dotnet

热点推荐