The following code snippet, as part of a class POP.vb, works:
Public Class PopMail
Private s As System.Net.Sockets.NetworkStream
Private t As New System.Net.Sockets.TcpClient
Private Connect As Boolean = False
Public Sub New(ByVal Server As String)
'open port 110 on the server
Try
'catch any error resulting from a bad server name
t.Connect(Server, 110)
s = t.GetStream()
If Left(getdata(), 3) = "+OK" Then
Connect = True
End If
Catch ex As Exception
However, if I use that same code within a form, it throws the error "'Public Property Left() as Integer' has no parameters and its return type cannot be indexed."
The definition of Left() on the form code points to System.Windows.Forms.Control. On the POP.vb class, it points to Microsoft.VisualBasic.Strings.
I can correct the error by prepending Left() with "Microsoft.VisualBasic." What I don't understand is why Left() means one thing on a form, and another in a class page? Can somebody explain this for me?
Thanks
Mike
Public Class PopMail
Private s As System.Net.Sockets.NetworkStream
Private t As New System.Net.Sockets.TcpClient
Private Connect As Boolean = False
Public Sub New(ByVal Server As String)
'open port 110 on the server
Try
'catch any error resulting from a bad server name
t.Connect(Server, 110)
s = t.GetStream()
If Left(getdata(), 3) = "+OK" Then
Connect = True
End If
Catch ex As Exception
However, if I use that same code within a form, it throws the error "'Public Property Left() as Integer' has no parameters and its return type cannot be indexed."
The definition of Left() on the form code points to System.Windows.Forms.Control. On the POP.vb class, it points to Microsoft.VisualBasic.Strings.
I can correct the error by prepending Left() with "Microsoft.VisualBasic." What I don't understand is why Left() means one thing on a form, and another in a class page? Can somebody explain this for me?
Thanks
Mike