Results 1 to 12 of 12

Thread: Problem

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2005
    Posts
    138

    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!

  2. #2
    Fanatic Member
    Join Date
    Jul 2006
    Location
    nasik,india
    Posts
    909

    Re: Problem

    can you post that code ?

  3. #3

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Sep 2005
    Posts
    138

    Re: Problem

    VB Code:
    1. Set recSet = New Recordset
    2.       recSet.Open "Select * from Users where stUserName=""" & LCase(Name) & """", dbConn, 1, 3
    3.       If recSet("stoffmsgs") <> "" Then
    4.       OfflineText = recSet("stoffmsgs")
    5.       recSet.Close
    6.       Set recSet = Nothing
    7.       'here is the problem, when I use f8 it pass SendOfflineMsg Function, but when I
    8.        'run it in the normal mode, it is not doing it
    9.       SendOfflineMsg OfflineText, Index
    10.       End If

  5. #5
    PowerPoster Simply Me's Avatar
    Join Date
    Aug 2003
    Posts
    2,748

    Re: Problem

    where is the call in your code? Can you post the code of your the function your are calling?
    To give is always to be NOBLE...
    To received is always to be BLESSED....
    Each day strive to be NOBLE
    Each day strive to be BLESSED

    If this post has helped you. Please take time to rate it.

    >=|+|=< Simply Me >=|+|=<

    ----------------------------------------
    Connection Strings | Number Only in Textbox | Splash Screen with Progress Bar | Printing to 1/2 of perforated bond paper |
    Freeze 2005 DataGridView Column

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Sep 2005
    Posts
    138

    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

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Sep 2005
    Posts
    138

    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

  8. #8
    PowerPoster Simply Me's Avatar
    Join Date
    Aug 2003
    Posts
    2,748

    Re: Problem

    Quote 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.
    To give is always to be NOBLE...
    To received is always to be BLESSED....
    Each day strive to be NOBLE
    Each day strive to be BLESSED

    If this post has helped you. Please take time to rate it.

    >=|+|=< Simply Me >=|+|=<

    ----------------------------------------
    Connection Strings | Number Only in Textbox | Splash Screen with Progress Bar | Printing to 1/2 of perforated bond paper |
    Freeze 2005 DataGridView Column

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Sep 2005
    Posts
    138

    Re: Problem

    how the function is not returning anything if am telling you that it is showing the text in msg box
    lol

  10. #10

    Thread Starter
    Addicted Member
    Join Date
    Sep 2005
    Posts
    138

    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.

  11. #11
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    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:
    1. 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

  12. #12

    Thread Starter
    Addicted Member
    Join Date
    Sep 2005
    Posts
    138

    Re: Problem

    VB Code:
    1. Sub LoginUser(Name As String, Index As Integer, Status As String)
    2.     On Error GoTo shoot:
    3.     If chkDisLog.Value = 1 Then ' Check box if enabled it sends to the index that the server is down and deny logging
    4.       SendSocket "ChatSock", "auth" & Chr(1) & "37", Index, Me
    5.       DoEvents
    6.       Exit Sub
    7.     End If
    8.     Dim sParts() As String, N As Long
    9.     Dim eParts() As String, EE As Long
    10.     SendSocket "ChatSock", "announce" & Chr(1) & txtAnnounce.Text, Index, Me 'send announcement to the status bar on the client
    11.     DoEvents
    12.         Set recSet = New Recordset
    13.         recSet.Open "Select * from Users where stUserName=""" & LCase(Name) & """", dbConn, 1, 3
    14.         XXYU = recSet("stUserName")
    15.         recSet("stlastlogin") = Format(Date, "dd.mm.yyyy") 'update this field
    16.         recSet.Update
    17.         LVU.ListItems.Add , "x" & Index, recSet("stUserName")
    18.         LVU.ListItems("x" & Index).SubItems(1) = recSet("stpassword")
    19.         BuddyList = recSet("stbudlist")
    20.         recSet.Close
    21.         Set recSet = Nothing
    22.         ListToSplit = CheckBudListField(XXYU)
    23.         StatusToBeSent = UserStatus(XXYU)
    24.         eParts = Split(ListToSplit, ",")
    25.         sParts = Split(BuddyList, ",")
    26.         For N = 0 To UBound(sParts)
    27.         If Int(CheckNickname(sParts(N))) = 0 Then
    28.         UsersPackage = UsersPackage & sParts(N) & Chr(2) & "5,"
    29.         DoEvents
    30.         Else
    31.         Select Case UserStatus(sParts(N))
    32.         Case "Available"
    33.         SS = "1"
    34.         Case "Away"
    35.         SS = "2"
    36.         Case "DND"
    37.         SS = "3"
    38.         Case "Invisible"
    39.         SS = "4"
    40.         End Select
    41.         UsersPackage = UsersPackage & sParts(N) & Chr(2) & SS & ","
    42.         DoEvents
    43.         End If
    44.         Next N
    45.         UsersPackageSent = Left(UsersPackage, Len(UsersPackage) - 1)
    46.         SendSocket "ChatSock", "budlist" & Chr(1) & UsersPackageSent, Index, Me
    47.         DoEvents
    48.         Set recSet = New Recordset
    49.         recSet.Open "Select * from Users where stUserName=""" & LCase(Name) & """", dbConn, 1, 3
    50.         If recSet("stoffmsgs") <> "" Then
    51.         OfflineText = recSet("stoffmsgs")
    52.         recSet.Close
    53.         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
    54.         DoEvents
    55.         End If
    56.         Set recSet = Nothing
    57.         UsersPackage = ""
    58.         For EE = 0 To UBound(eParts)
    59.         DoEvents
    60.         If CheckNickname(eParts(EE)) = 1 Then
    61.         SendSocket "ChatSock", "loggedin" & Chr(1) & xxYU & Chr(2) & StatusToBeSent, (NameInUse(eParts(EE))), Me
    62.         DoEvents
    63.         End If
    64.         Next EE
    65. Exit Sub
    66. shoot:
    67.     ChatSock_Close Index
    68. End Sub
    69.  
    70.  
    71. Function NameInUse(Name As String) As String
    72.     On Error Resume Next
    73.     NameInUse = "0"
    74.     For i = 1 To LVU.ListItems.Count
    75.         If LCase(LVU.ListItems.Item(i)) = LCase(Name) Then
    76.             NameInUse = Right(LVU.ListItems.Item(i).Key, Len(LVU.ListItems.Item(i).Key) - 1)
    77.             Exit Function
    78.         End If
    79.     Next
    80. End Function
    81.  
    82. Public Function CheckNickname(Nickname As String) As Integer
    83. CheckNickname = 0
    84. For i = 1 To LVU.ListItems.Count
    85. If LVU.ListItems.Item(i).Text = Nickname Then
    86. CheckNickname = 1
    87. Exit Function
    88. End If
    89. Next i
    90. End Function
    91.  
    92.  
    93. ' now in a module I have this
    94.  
    95. Sub SendSocket(wSck As String, msg As String, Index As Integer, Frm As Form)
    96.     If Frm.Controls(wSck)(Index).State = 7 Then
    97.         Frm.Controls(wSck)(Index).SendData msg & Chr(0)
    98.     End If
    99. 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
  •  



Click Here to Expand Forum to Full Width