Click here to Skip to main content
15,884,537 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to implement a timer in Windows Service correctly? Pin
DoctorMick15-Jul-09 6:26
DoctorMick15-Jul-09 6:26 
GeneralRe: How to implement a timer in Windows Service correctly? Pin
astv15-Jul-09 10:41
astv15-Jul-09 10:41 
GeneralRe: How to implement a timer in Windows Service correctly? Pin
Luc Pattyn15-Jul-09 6:26
sitebuilderLuc Pattyn15-Jul-09 6:26 
GeneralRe: How to implement a timer in Windows Service correctly? Pin
astv15-Jul-09 10:43
astv15-Jul-09 10:43 
GeneralRe: How to implement a timer in Windows Service correctly? Pin
Paladin200015-Jul-09 6:27
Paladin200015-Jul-09 6:27 
GeneralRe: How to implement a timer in Windows Service correctly? Pin
astv15-Jul-09 10:45
astv15-Jul-09 10:45 
AnswerRe: How to implement a timer in Windows Service correctly? Pin
dan!sh 15-Jul-09 6:28
professional dan!sh 15-Jul-09 6:28 
QuestionOutlook newitem event issue [modified] Pin
ghoster00715-Jul-09 5:06
ghoster00715-Jul-09 5:06 
I'm trying to make a helpdesk application that processes incoming emails for a specific account. I'm having trouble with the Itemadd event. It will quit after receiving around 17-28 emails and I have to restart the program. I have not found much online about this issue besides it's probably a scope problem and the GC is killing the event. I did make a stripped down version of the program which seems to work fine but I dont know why it works when this one doesn't.


In the load function of the form im using this for getting the namespace and the correct store. All variables not initialized in the code are private.

If I comment out treeview1_add function it'll work up to 30 emails which probably means it's working. However I do not know why commenting out that function will make it work and I need that function.

thank you for any help you can give me.
<code>
void form_load()
{
   mapi = outlookapp.GetNamespace("MAPI");

                int helpdeskcount = 1;
                int count = 1;
                while (count <= mapi.Stores.Count)
                {
                    if (mapi.Stores[count].DisplayName.Contains("Storename"))
                    {
                        helpdeskcount = count;
                        count = mapi.Stores.Count;
                    }
                    count++;
                }
                oinbox = mapi.Folders[helpdeskcount];
                helpdesk = oinbox.Folders["Inbox"];
                helpdesk.Items.ItemAdd += new ItemsEvents_ItemAddEventHandler(Items_ItemAdd);  
}
   void Items_ItemAdd(object Item)
        {

              load_unassigned();  
              counter();//debug use to see how many emails come in
        }

 void counter()
        {
            if (this.InvokeRequired)
            {
                this.Invoke(new Invoker_no_strings(this.counter));

            }
            else
            {
                int count = int.Parse(label1.Text);
                count++;
                label1.Text = count.ToString();
            }
        }

      public void load_unassigned()
        {
           
         
                tree_node_clear(treeView1);
                incident_load = new tbl_incidents_BLL();
                 tempnode = null;
                 arrtemp = incident_load.loadallunassigned();
                
                int length = arrtemp.GetLength(0);
                int count = 0;
             
                while (count < length)
                {
                  
                   treeview1_add(arrtemp[count, 0], arrtemp[count, 1] + ":  " + arrtemp[count, 3]);//if i comment this out it'll work to at least 30 emails 
                  
                    count++;
                }
            }

    public  void tree_node_clear(TreeView temp)
        {
            if (this.InvokeRequired)
            {
                this.Invoke(new tree_clear(this.tree_node_clear), temp);
            }
            else
            {
                temp.Nodes.Clear();


            }

        }

      public void treeview1_add(string id, string value)
        {


            if (this.InvokeRequired)
            {
               
                    this.Invoke(new treeview1_add_delegate(this.treeview1_add), id, value);
       
                
            }
            else
            {
              
                    treeView1.Nodes.Add(id, value);
                
                   
                
            }
          
        }
}</code>


ghoster

modified on Wednesday, July 15, 2009 12:04 PM

AnswerRe: Outlook newitem event issue Pin
Luc Pattyn15-Jul-09 6:19
sitebuilderLuc Pattyn15-Jul-09 6:19 
GeneralRe: Outlook newitem event issue Pin
ghoster00715-Jul-09 7:00
ghoster00715-Jul-09 7:00 
GeneralRe: Outlook newitem event issue Pin
Luc Pattyn15-Jul-09 7:08
sitebuilderLuc Pattyn15-Jul-09 7:08 
GeneralRe: Outlook newitem event issue Pin
ghoster00715-Jul-09 9:08
ghoster00715-Jul-09 9:08 
QuestionUse of GC.SuppressFinalize in ref counted objects Pin
molesworth15-Jul-09 4:55
molesworth15-Jul-09 4:55 
QuestionCreating four dimensional control Pin
gwithey15-Jul-09 4:32
gwithey15-Jul-09 4:32 
AnswerRe: Creating four dimensional control Pin
OriginalGriff15-Jul-09 4:49
mveOriginalGriff15-Jul-09 4:49 
GeneralRe: Creating four dimensional control Pin
gwithey15-Jul-09 4:54
gwithey15-Jul-09 4:54 
GeneralRe: Creating four dimensional control Pin
molesworth15-Jul-09 5:12
molesworth15-Jul-09 5:12 
GeneralRe: Creating four dimensional control Pin
OriginalGriff15-Jul-09 5:26
mveOriginalGriff15-Jul-09 5:26 
GeneralRe: Creating four dimensional control Pin
molesworth15-Jul-09 6:13
molesworth15-Jul-09 6:13 
GeneralRe: Creating four dimensional control Pin
OriginalGriff15-Jul-09 8:13
mveOriginalGriff15-Jul-09 8:13 
QuestionHow to get the control property 'Handle' and 'Name' Pin
Durchleuchter15-Jul-09 4:12
Durchleuchter15-Jul-09 4:12 
AnswerRe: How to get the control property 'Handle' and 'Name' Pin
Dave Kreskowiak15-Jul-09 5:22
mveDave Kreskowiak15-Jul-09 5:22 
QuestionConvert HTML to RTF Pin
Sebastian T Xavier15-Jul-09 3:40
Sebastian T Xavier15-Jul-09 3:40 
AnswerRe: Convert HTML to RTF Pin
Christian Graus15-Jul-09 3:42
protectorChristian Graus15-Jul-09 3:42 
AnswerRe: Convert HTML to RTF Pin
Alan Balkany15-Jul-09 3:51
Alan Balkany15-Jul-09 3:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.