locked
Timer Intervals RRS feed

  • Question

  • Ok so i have a problem

    I have a timer.start in one sub

    Private Sub ServerLocationToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ServerLocationToolStripMenuItem.Click
        OpenFileDialog1.ShowDialog()
        Timer1.Start()
      End Sub

    Then in another one

     Private Sub ToolStripMenuItem2_Start(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem2.Click
        ToolStripMenuItem2.Text = OpenFileDialog1.FileName
        If Timer1.Interval() Then Refresh()
      End Sub
    End Class

    What i want to happen is when i click ServerLocationToolStripMenu i want the ToolStripMenuItem2 to show the name of a file that was selected

    When i click ToolStripMenuItem2 , it refreshes it self to show the Filename chosen in the OpenFileDialog1

    I want it so that the timer starts when i click ServerLocationToolStripMenu the timer starts and when the timer has an interval i want the ToolStripMenuItem2 to refresh the filename show with it

    Thursday, September 30, 2010 3:12 AM

Answers

  •     If Timer1.Interval() Then Refresh()

    I don't follow what you are trying to do with this line.  When the timer elapses, the Tick event on the timer is raised.  So that means you probably need a Timer1_Tick handler on your form.  In that handler, put the code you want to run every time the interval elapses.  (Furthermore, Stop the timer if necessary.)

     

    Thursday, September 30, 2010 3:18 AM

All replies

  •     If Timer1.Interval() Then Refresh()

    I don't follow what you are trying to do with this line.  When the timer elapses, the Tick event on the timer is raised.  So that means you probably need a Timer1_Tick handler on your form.  In that handler, put the code you want to run every time the interval elapses.  (Furthermore, Stop the timer if necessary.)

     

    Thursday, September 30, 2010 3:18 AM
  • When the timer interval happens i want the ToolStripMenuItem2 to refresh the name of the file that has been chosen by the OpenFileDialog
    Thursday, September 30, 2010 3:27 AM
  • > has been chosen by the OpenFileDialog

    Why don't you just do that right after the call from OpenFileDialog returns successfully?

     

    Thursday, September 30, 2010 3:58 AM