Jay1b Posted September 15, 2003 Posted September 15, 2003 (edited) 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 Dim timer1 As New Timer timer1.Interval = 5000 timer1.Enabled = True timer1.Start() and 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? Thanksminimise_troubles.zip Edited February 21, 2007 by PlausiblyDamp Quote
Jay1b Posted September 15, 2003 Author Posted September 15, 2003 In addition to that i would love to know how to create a AxMsComm thingy (the phone on the modem picture) via code. :) Quote
Administrators PlausiblyDamp Posted September 15, 2003 Administrators Posted September 15, 2003 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) 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 Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Jay1b Posted September 15, 2003 Author Posted September 15, 2003 It a quick test form, it works great thanks. I will try it with my actual program now (fingers crossed). :) Quote
Jay1b Posted September 15, 2003 Author Posted September 15, 2003 The messagebox works fine, which is a brilliant sign - i just hope the rest of my code holds up. Thanks again Quote
Jay1b Posted September 15, 2003 Author Posted September 15, 2003 Any idea's on the AxMsComm bit of it? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.