想将C#代码转换成VB.NET代码,具体代码如下: 10
C#代码:privatedelegatestring[]InternalDelegate();privateInternalDelegateintlDelg;intlDe...
C#代码:
private delegate string[] InternalDelegate();
private InternalDelegate intlDelg;
intlDelg = new InternalDelegate( sqlInfo.EnumerateSQLServers);
试着转换为VB.Net代码
Private Delegate Function InternalDelegate() As String()
Private intlDelg As InternalDelegate
intlDelg = New InternalDelegate(AddressOf sqlInfo.SQLInfoEnumerator)
但是有错误 展开
private delegate string[] InternalDelegate();
private InternalDelegate intlDelg;
intlDelg = new InternalDelegate( sqlInfo.EnumerateSQLServers);
试着转换为VB.Net代码
Private Delegate Function InternalDelegate() As String()
Private intlDelg As InternalDelegate
intlDelg = New InternalDelegate(AddressOf sqlInfo.SQLInfoEnumerator)
但是有错误 展开
展开全部
你这是声明一个委托吧? 这是我写的一个委托,你参考下,你的代码也不全!有全的,我可以试着帮你看看!
Public Delegate Sub setlist(ByVal ListUsers() As String)
Private Sub ListUsers(ByVal users() As String)
Try
Dim lusers() As String
lusers = users
If lstUsers.InvokeRequired Then
Dim List As setlist = New setlist(AddressOf ListUsers)
Invoke(List, New Object() {users})
Else
Dim I As Integer
For I = 1 To users.Length - 1
lstUsers.Items.Add(users(I))
Next
End If
Catch ex As Exception
MessageBox.Show("异常错误:" & ex.Message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning)
End Try
End Sub
Public Delegate Sub setlist(ByVal ListUsers() As String)
Private Sub ListUsers(ByVal users() As String)
Try
Dim lusers() As String
lusers = users
If lstUsers.InvokeRequired Then
Dim List As setlist = New setlist(AddressOf ListUsers)
Invoke(List, New Object() {users})
Else
Dim I As Integer
For I = 1 To users.Length - 1
lstUsers.Items.Add(users(I))
Next
End If
Catch ex As Exception
MessageBox.Show("异常错误:" & ex.Message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning)
End Try
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询