سؤال

I have some VB6 code that I am trying to convert over to .NET, in the code the bind part of the pipe code is throwing an error. Here is the code:

With Pipe
        .RemoteHost = "127.0.0.1"
        .RemotePort = CInt("12346")
        .LocalPort = CInt("12345")
        .Bind(.LocalPort)
End With

The error that is being thrown is

Overload resolution failed because no accessible 'Bind' accepts this number of arguments.

I am confused, since this code worked in VB6 and .Bind has the argument of .LocalPort

Can someone please tell me how you would do this in .NET?

هل كانت مفيدة؟

المحلول 2

We ended up not needing to use this code. Since I couldn't figure out how to get the code to work in .NET, I just commented the code out. I ran and tested the app, and there wasn't any issues. I didn't create the app, so I am not sure why or how that code was being used anyway.

نصائح أخرى

Looks like your LocalPort is an integer type, and the Bind method expects a string. VB6 would silently coerce the integer to a string for you. VB.NET does not. Try changing it to .Bind(.LocalPort.ToString()) and that should work. I did VB6 back in the day, but never VB.NET -- so YMMV.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top