Results 1 to 2 of 2

Thread: Help!

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2010
    Posts
    53

    Question Help!

    hi guys,

    i created a program that checks if there is a new order. it has a refresh button that is timed with a timer so that every xx seconds, "refreshed" to see if there are new orders, so that it can be sort of a real time program. when it has a new order, a msgbox will pop and asks if the user wants to go to the site.


    the program is working fine when the form is loaded; msgbox pops out and nothing else pops out even after xx seconds,


    but my problem is when i close the msgbox, perhaps i clicked "no". after xx seconds the msgbox will pop out because for example there is a new order, if i did not click either yes or no. another msgbox will pop out, and another and another and another depending on the timer.interval that i used. what i want is when there is a msgbox that is active, i do not want any other msgbox to be popped again, because its annoying and redundant.

    guys please help me and tell me if its confusing.

    i am open for any suggestions! thanks very much!



    Code:
     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            
    
    
            Timer1.Interval = 5000
            Timer1.Enabled = True
    
           (CONNECTION STRINGS)
    
    
                For Each item In ListBox1.Items
    
                    If DirectCast(item, DataRowView).Item("status") = Label1.Text Then
    
                        MsgBox()
    
                    End If
    
                Next
    
    end sub
    
     Public Sub MsgBox()
            Dim Shell As Object
            Dim message As Integer
            Shell = CreateObject("Wscript.Shell")
    
            message = MsgBox("There is NEW Order, would you like to go to the site?", _
                               vbYesNo, "ALARM")
    
            If message= vbYes Then
                Shell.Run("http://")
            Else
                Exit Sub
            End If
    
            If message = Enabled Then
                Timer1.Stop()
                Timer1.Dispose()
    
            Else
    
                Timer1.Interval = 5000
                Timer1.Enabled = True
            End If
    
        End Sub
    
    
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
            Button1.PerformClick()
        End Sub
    
    
    
     Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    
            Timer1.Interval = 5000
            Timer1.Enabled = True
    
           (CONNECTION STRINGS)
    
    
                For Each item In ListBox1.Items
    
                    If DirectCast(item, DataRowView).Item("status") = Label1.Text Then
    
                        MsgBox()
    
                    End If
    
                Next
    
    end sub

  2. #2

Tags for this Thread

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