|
-
Feb 6th, 2004, 10:54 AM
#1
Thread Starter
Addicted Member
Timer callback
Hi,
I have a form and have created a timer. I want my timer to watch a print queue (look for changes every 5 seconds or whatever) and then update a listview on the main form. The problem is I can't think of a way to make the timer inform the form that something has happened - or another way I have tried to tackle it is to pass the object reference of the listview into the timer routine...... anybody got any examples/ideas?
Regards,
DJ
-
Feb 6th, 2004, 11:15 AM
#2
Frenzied Member
Okay. I have a question. Where is the timer created and where is the form created? I am assuming they are on diffirent forms or something.
There are several answers.
1) Create a public wrapper for the listbox.Items.Add() in the form that contains it(optional but creates less typing) and pass a refreance of the form to where ever. I usualy do that with a constructor.
2) impliment the VB6 Forms Collection I posted in this forum. it will solve that problem quickly with only two changes to you code. Add an Ex to you Form
Code:
public class myForm : System.Windows.Forms.FormEx
inheritance statement and construct your form using a key
Code:
myForm frm = new myForm("myForm1");
.
and finally
Code:
System.Windows.Forms.FormEx.Forms["myForm1"].ListAdd(QueeItem);
3)put the timer on the form with the listbox and do this.listboxname.Items.Add(QueeItem);
4)I dunno somebody provide 4
Magiaus
If I helped give me some points.
-
Feb 6th, 2004, 07:06 PM
#3
Frenzied Member
Re: Timer callback
Originally posted by DJ_Catboy
Hi,
I have a form and have created a timer. I want my timer to watch a print queue (look for changes every 5 seconds or whatever) and then update a listview on the main form. The problem is I can't think of a way to make the timer inform the form that something has happened - or another way I have tried to tackle it is to pass the object reference of the listview into the timer routine...... anybody got any examples/ideas?
Regards,
DJ
You might want to take a look at this http://msdn.microsoft.com/msdnmag/is...T/default.aspx
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|