Code Conversion from C#.net to VB.net

Posted by Dnandha87 under VB.NET on 10/11/2012 | Points: 10 | Views : 1166 | Status : [Member] | Replies : 7
kindly help me to convert the below C#.net code to VB.net::


private FTPStream EndStreamCommand(FTPStream.EAllowedOperation allowedOp)
{
return new FTPStream(GetDataStream(), allowedOp,
delegate() {
CloseDataConnection();
if (waitingCompletionReply)
GetReply();
});
}

Regards
Nandha Kumar,



Responses

Posted by: Vakulkumarmore on: 10/11/2012 [Member] [MVP] Starter | Points: 25

Up
0
Down
Private Function EndStreamCommand(allowedOp As FTPStream.EAllowedOperation) As FTPStream

Return New FTPStream(GetDataStream(), allowedOp, Function() Do
CloseDataConnection()
If waitingCompletionReply Then
GetReply()
End If
End Function)
End Function


Dnandha87, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vakulkumarmore on: 10/11/2012 [Member] [MVP] Starter | Points: 25
Posted by: Dnandha87 on: 10/11/2012 [Member] Starter | Points: 25

Up
0
Down
getting below compilation error...

End of Statement Expected.
'End Function' must be preceded by the End Function.

Regards
Nandha Kumar,

Dnandha87, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vakulkumarmore on: 10/11/2012 [Member] [MVP] Starter | Points: 25

Up
0
Down
1. Check to see if two different statements have inadvertently been put on the same line.
2. Insert a line terminator after the element that completes the statement.

Dnandha87, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Dnandha87 on: 10/11/2012 [Member] Starter | Points: 25

Up
0
Down
here the delegate event has to be raised....
But don't know how to implement that in VB.net...


Regards
Nandha Kumar,

Dnandha87, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vakulkumarmore on: 10/11/2012 [Member] [MVP] Starter | Points: 25

Up
0
Down
http://visualbasic.about.com/od/usingvbnet/a/delegates.htm

Dnandha87, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vakulkumarmore on: 10/11/2012 [Member] [MVP] Starter | Points: 25

Up
0
Down
Public Class MyEvt

Public Delegate Sub t(ByVal sender As [Object], ByVal e As MyArgs)
' declare a delegate
Public Event tEvt As t
'declares an event for the delegate
Public Sub mm()
'function that will raise the callback
Dim r As New MyArgs()
RaiseEvent tEvt(Me, r)
'calling the client code
End Sub
Public Sub New()
End Sub
End Class
'arguments for the callback
Public Class MyArgs
Inherits EventArgs
Public Sub New()
End Sub
End Class
Public Class MyEvtClient
Private oo As MyEvt
Public Sub New()
Me.oo = New MyEvt()
AddHandler Me.oo.tEvt, New MyEvt.t(AddressOf oo_tt)
End Sub
Public Shared Sub Main(ByVal args As [String]())
Dim cc As New MyEvtClient()
cc.oo.mm()
End Sub
'this code will be called from the server
Public Sub oo_tt(ByVal sender As Object, ByVal e As MyArgs)
Console.WriteLine("yes")
Console.ReadLine()
End Sub
End Class


Dnandha87, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response