Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Timer problem...

Timer problem...

Scheduled Pinned Locked Moved Visual Basic
helpquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Ruca
    wrote on last edited by
    #1

    Hi, I'm iusing a Do..until loop to receive data from a modem, one of the conditions for the loop to finish is a boolean variable (bTimeOut), assined to TRUE when then Timer finish is count, i did like: Settings.bTimeOut = False Settings.Timer1.Enabled = True Do If Main.MSComm1.InBufferCount Then Buffer = Buffer & Main.MSComm1.Input Loop Until (InStr(1, Buffer, Res & vbCrLf) Or (Settings.bTimeOut = True)) Settings.Timer1.Enabled = False Settings.bTimeOut = False The problem is that if, the modem answer is not like Res, the loop never ends, i cannot understand why does the Timer do not change my variable state, its function is like: Public Sub Timer1_Timer() bTimeOut = True Timer1.Enabled = False End Sub Can anyone help me with this? Thank you for your time Rui

    F 1 Reply Last reply
    0
    • R Ruca

      Hi, I'm iusing a Do..until loop to receive data from a modem, one of the conditions for the loop to finish is a boolean variable (bTimeOut), assined to TRUE when then Timer finish is count, i did like: Settings.bTimeOut = False Settings.Timer1.Enabled = True Do If Main.MSComm1.InBufferCount Then Buffer = Buffer & Main.MSComm1.Input Loop Until (InStr(1, Buffer, Res & vbCrLf) Or (Settings.bTimeOut = True)) Settings.Timer1.Enabled = False Settings.bTimeOut = False The problem is that if, the modem answer is not like Res, the loop never ends, i cannot understand why does the Timer do not change my variable state, its function is like: Public Sub Timer1_Timer() bTimeOut = True Timer1.Enabled = False End Sub Can anyone help me with this? Thank you for your time Rui

      F Offline
      F Offline
      FruitBatInShades
      wrote on last edited by
      #2

      Have you checked that Settings.bTimeOut is actually being set? Add a watch to the Settings.bTimeOut in the loop and see if it's being set.

      R 1 Reply Last reply
      0
      • F FruitBatInShades

        Have you checked that Settings.bTimeOut is actually being set? Add a watch to the Settings.bTimeOut in the loop and see if it's being set.

        R Offline
        R Offline
        Ruca
        wrote on last edited by
        #3

        Thank you LeeDavies for your answer! Yes, i tried checking the variable state during the loop, i even tried a MsgBox inside the Timer1 function, just to know if it was working! The Timer interval is 2000, instead it never displays the MsgBox, can't understand why... Could it be because, i keep reading from the modem..??? Rui

        F 1 Reply Last reply
        0
        • R Ruca

          Thank you LeeDavies for your answer! Yes, i tried checking the variable state during the loop, i even tried a MsgBox inside the Timer1 function, just to know if it was working! The Timer interval is 2000, instead it never displays the MsgBox, can't understand why... Could it be because, i keep reading from the modem..??? Rui

          F Offline
          F Offline
          FruitBatInShades
          wrote on last edited by
          #4

          It's been staring me in the face all the time. The timer is not being started. It should be timer1.Start and Timer1.Stop, not Timer1.enabled = true

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups