Ok, this appears to be working. Its the wierdest thing I have seen yet in
..Net:
It appears that Directly manipulating the MyServerConnections ArrayList
confuses everything. So, creating a "pointer", updating the pointer then
copying back seems to be working. WHAT A PAIN.
Is this a bug? This is not how you would think it should work.
Public Function SetClient(ByVal PublicServerConnection As
PublicServerStruct, ByRef MyClient As System.Net.Sockets.TcpClient)
Dim Myindex As Integer =
ReturnArrayIndexOfClient(PublicServerConnection)
If Not IsNothing(Myindex) Then
Dim LocalPrivateServer As PrivateServerConnectionStruct
LocalPrivateServer = CType(MyServerConnections(Myindex - 1),
PrivateServerConnectionStruct)
LocalPrivateServer.client = MyClient
MyServerConnections(Myindex - 1) = LocalPrivateServer
End If
End Function
"gregory_may" <None> wrote in message
news:e%****************@TK2MSFTNGP10.phx.gbl...
I want to prevent late binding of this statement:
MyServerConnections(Myindex).client = Value
But when I try with the code below, I get an editor error:
"Expression is a value and therefor cant be the target of an assignment"
CType(MyServerConnections(Myindex), PrivateServerConnectionStruct).Client
= value
What is going on here?
For reference, here is the struct definition:
Private Structure PrivateServerConnectionStruct
Dim client As System.Net.Sockets.TcpClient
Dim Connected_To_Server As Boolean
Dim Connected_User_Name As String
Dim Remote_port_num As Integer
Dim Remote_host_name As String
Dim MessageQueue As Queue
End Structure
Dim MyServerConnections As New ArrayList