|
-
Aug 18th, 2006, 03:37 AM
#1
Thread Starter
Addicted Member
Problem
Hello everyone
I have a weird type of problems
Something never happend to me before
I am calling a function somewhere on the code
it is not happening
so
I tried to put the breakpoint before that function and used F8 to trace the code and try to debug it.
Now what is suprising me is
that the tracer is passing and calling that function, but when I try to run the code on the normal mode it is not happening
what is the explination for something the tracer read it, and the normal run mode don't read it ?
Thanks in advanced!
-
Aug 18th, 2006, 03:45 AM
#2
Fanatic Member
-
Aug 18th, 2006, 03:48 AM
#3
Re: Problem
Maybe your function doesn't return.
-
Aug 18th, 2006, 03:48 AM
#4
Thread Starter
Addicted Member
Re: Problem
VB Code:
Set recSet = New Recordset
recSet.Open "Select * from Users where stUserName=""" & LCase(Name) & """", dbConn, 1, 3
If recSet("stoffmsgs") <> "" Then
OfflineText = recSet("stoffmsgs")
recSet.Close
Set recSet = Nothing
'here is the problem, when I use f8 it pass SendOfflineMsg Function, but when I
'run it in the normal mode, it is not doing it
SendOfflineMsg OfflineText, Index
End If
-
Aug 18th, 2006, 03:51 AM
#5
PowerPoster
Re: Problem
where is the call in your code? Can you post the code of your the function your are calling?
-
Aug 18th, 2006, 03:54 AM
#6
Thread Starter
Addicted Member
Re: Problem
call what ?
it reads recSet("stoffmsgs") from the db
and reverse it in a string called OfflineText
now there is a function called SendOfflineMsg
it is calling it when I try to trace using F8 and working fine, but when I run it normally, it is not doing any action.
very weird.
how come if I trace it work, and when I run it don't work
-
Aug 18th, 2006, 03:56 AM
#7
Thread Starter
Addicted Member
Re: Problem
it is not a problem in the function
lets say it is a message box
Public Function SendOfflineMsg(msg As String, Index As Integer)
msgbox msg & index
End Function
-
Aug 18th, 2006, 03:58 AM
#8
PowerPoster
Re: Problem
 Originally Posted by ASoufan
I am calling a function somewhere on the code
I thought you said this so I am asking where in your code did you call your Function? and maybe gavio is right...the function is not returning anything.
-
Aug 18th, 2006, 04:00 AM
#9
Thread Starter
Addicted Member
Re: Problem
how the function is not returning anything if am telling you that it is showing the text in msg box
lol
-
Aug 18th, 2006, 04:09 AM
#10
Thread Starter
Addicted Member
Re: Problem
what is suprising me that if I put any message box before the function
it shows it
and once I click ok
the function works
without that
it is not doing any action.
-
Aug 18th, 2006, 10:27 AM
#11
Re: Problem
1) Post the whole function, including the declaration and the End Function line.
2) Post the code that's supposed to be calling the function.
3) Set recSet = New ADO Recordset? Set recSet = New DAO Recordset? Which reference are you including? (I'd assume DAO, but VB won't assume either one.)
4) The line should be:
VB Code:
recSet.Open "Select * from Users where stUserName='" & LCase(Name) & "'", dbConn, 1, 3
There's no need to use multiple Chr(34)s.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
-
Aug 19th, 2006, 08:33 AM
#12
Thread Starter
Addicted Member
Re: Problem
VB Code:
Sub LoginUser(Name As String, Index As Integer, Status As String)
On Error GoTo shoot:
If chkDisLog.Value = 1 Then ' Check box if enabled it sends to the index that the server is down and deny logging
SendSocket "ChatSock", "auth" & Chr(1) & "37", Index, Me
DoEvents
Exit Sub
End If
Dim sParts() As String, N As Long
Dim eParts() As String, EE As Long
SendSocket "ChatSock", "announce" & Chr(1) & txtAnnounce.Text, Index, Me 'send announcement to the status bar on the client
DoEvents
Set recSet = New Recordset
recSet.Open "Select * from Users where stUserName=""" & LCase(Name) & """", dbConn, 1, 3
XXYU = recSet("stUserName")
recSet("stlastlogin") = Format(Date, "dd.mm.yyyy") 'update this field
recSet.Update
LVU.ListItems.Add , "x" & Index, recSet("stUserName")
LVU.ListItems("x" & Index).SubItems(1) = recSet("stpassword")
BuddyList = recSet("stbudlist")
recSet.Close
Set recSet = Nothing
ListToSplit = CheckBudListField(XXYU)
StatusToBeSent = UserStatus(XXYU)
eParts = Split(ListToSplit, ",")
sParts = Split(BuddyList, ",")
For N = 0 To UBound(sParts)
If Int(CheckNickname(sParts(N))) = 0 Then
UsersPackage = UsersPackage & sParts(N) & Chr(2) & "5,"
DoEvents
Else
Select Case UserStatus(sParts(N))
Case "Available"
SS = "1"
Case "Away"
SS = "2"
Case "DND"
SS = "3"
Case "Invisible"
SS = "4"
End Select
UsersPackage = UsersPackage & sParts(N) & Chr(2) & SS & ","
DoEvents
End If
Next N
UsersPackageSent = Left(UsersPackage, Len(UsersPackage) - 1)
SendSocket "ChatSock", "budlist" & Chr(1) & UsersPackageSent, Index, Me
DoEvents
Set recSet = New Recordset
recSet.Open "Select * from Users where stUserName=""" & LCase(Name) & """", dbConn, 1, 3
If recSet("stoffmsgs") <> "" Then
OfflineText = recSet("stoffmsgs")
recSet.Close
SendSocket "ChatSock", "offmsgs" & Chr(1) & OfflineText, Index, Me ' here is my problem it is not doing this line, if i put message box before it and I click it when it shows, it execute this command, or if I put it over budlist command it executes it and not executing budlist command, but when I trace the code it does it, very weird
DoEvents
End If
Set recSet = Nothing
UsersPackage = ""
For EE = 0 To UBound(eParts)
DoEvents
If CheckNickname(eParts(EE)) = 1 Then
SendSocket "ChatSock", "loggedin" & Chr(1) & xxYU & Chr(2) & StatusToBeSent, (NameInUse(eParts(EE))), Me
DoEvents
End If
Next EE
Exit Sub
shoot:
ChatSock_Close Index
End Sub
Function NameInUse(Name As String) As String
On Error Resume Next
NameInUse = "0"
For i = 1 To LVU.ListItems.Count
If LCase(LVU.ListItems.Item(i)) = LCase(Name) Then
NameInUse = Right(LVU.ListItems.Item(i).Key, Len(LVU.ListItems.Item(i).Key) - 1)
Exit Function
End If
Next
End Function
Public Function CheckNickname(Nickname As String) As Integer
CheckNickname = 0
For i = 1 To LVU.ListItems.Count
If LVU.ListItems.Item(i).Text = Nickname Then
CheckNickname = 1
Exit Function
End If
Next i
End Function
' now in a module I have this
Sub SendSocket(wSck As String, msg As String, Index As Integer, Frm As Form)
If Frm.Controls(wSck)(Index).State = 7 Then
Frm.Controls(wSck)(Index).SendData msg & Chr(0)
End If
End Sub
and I have a refferend MS ActiveX Data Object 2.8
Last edited by ASoufan; Aug 19th, 2006 at 08:40 AM.
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
|