|
-
May 4th, 2007, 04:49 AM
#1
Thread Starter
New Member
-
May 4th, 2007, 04:56 AM
#2
Re: How to determine a winsock control is loaded?
Code:
Winsock(Index).State = 7
That is the state of connection.
-
May 4th, 2007, 06:08 AM
#3
Thread Starter
New Member
Re: How to determine a winsock control is loaded?
To Hell-Lord
As you suggested.
Winsock(Index).State = 7
is not the correct method or what i aspect to do.
The code statement you suggested is also leads to the same error "Control array element does not exists"
Since if the Winsocke(Index) is not loaded in the form then how you can check the state of the Winsock(Index) {It dose not matter whatever array element is i.e. Index}
And the Winsock(Index).State = 7 Just tell us about the socket is connected to either remote host or to the client. i does not tell us about that the socket is loaded in form or not.
What actually i am trying to do is can be simulated by following escudo code
code:-
If isloaded(Winsock(Index)) = True Then
If Winsock(Index).State = 7 Then
Winsock(Index).SendData " DATA"
Else
Unload Winsock(Index)
End If
End If
Now can any one please tell me the answer for this that how to write function that will tell that is the particular Winsock array element is loaded in the form or not.
If the element is loaded into the form then the function will return True else it will return False.
Function in green color text is not exists i need to write similar kind of the function.
Please Help.
-
May 4th, 2007, 06:14 AM
#4
Re: How to determine a winsock control is loaded?
You need to keep track of all the elements of your array (of winsocks) that are currently in existance. The problem arrises when you are killing items of that array in middle, you either have to condense the array (in order to have all consecutive indexs used) or maintain a list of the used indexes.
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button
Wait, I'm too old to hurry!
-
May 4th, 2007, 06:24 AM
#5
Thread Starter
New Member
Re: How to determine a winsock control is loaded?
To opus,
Yes this can be one of the solution. but this make my code more slower. since already my code is to big this will add more complexity to my code.
Can't we determine that witch control is loaded in the form?
-
May 4th, 2007, 03:28 PM
#6
Re: How to determine a winsock control is loaded?
Perhaps something like:
Code:
Option Explicit
Private Function IsLoaded(ByVal Control As Control) As Boolean
Dim S As String
On Error Resume Next
S = Control.Name 'Try to fetch control's name.
IsLoaded = Err.Number = 0
End Function
Private Sub Form_Load()
Load Label1(2)
MsgBox IsLoaded(Label1(0))
MsgBox IsLoaded(Label1(1))
MsgBox IsLoaded(Label1(2))
Unload Me
End Sub
-
May 5th, 2007, 12:47 AM
#7
Thread Starter
New Member
-
May 5th, 2007, 03:22 AM
#8
Re: [RESOLVED] How to determine a winsock control is loaded?
Sorry gnk i misunderstood your question >.<
My code just checked if the winsock was connected
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|