Minimised to the Status bar

Jay1b

Contributor
Joined
Aug 3, 2003
Messages
640
Location
Kent, Uk.
Having copied a sample of code posted somewhere (here i believe). I am managed to get an icon appear in my status bar for the program i am working on. This works by having a hidden startup form, separate from the main form that the user see's.

What i need to do is have a timer running in the background, whilst the icon is minimised.

Firstly i tried adding it to the hidden startup form, but as expected, the form wouldnt check the timer, if its hidden.

Secondly i tried creating one in code using the code below
Visual Basic:
        Dim timer1 As New Timer
        timer1.Interval = 5000
        timer1.Enabled = True
        timer1.Start()
and
Visual Basic:
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)
        MsgBox("in form")
    End Sub

But needless to say that didnt work as well.

I have lots of process that i want carried out in the background, for this - obviously to start with i am content in getting a timer to show a msgbox every 5 seconds.

Could someone please point me in the right direction?

Thanks
 

Attachments

Last edited by a moderator:
In addition to that i would love to know how to create a AxMsComm thingy (the phone on the modem picture) via code. :)
 
Have you tried using the timer from system.Threading? The following snippet should give you the idea (just past into a form with a single button)
Visual Basic:
Private Sub Tick(ByVal state As Object)
        MessageBox.show("test")
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Me.Visible = False
        Dim t As New System.Threading.Timer(AddressOf Tick, Nothing, 0, 5000)

    End Sub
 
Back
Top