Solved

Notifyicon using VB.Net 2010 Express

Posted on 2010-11-14
19
1,180 Views
Last Modified: 2012-05-10
Hi,
I have a program that utilizes the notifyicon and implements classes with embeded (not sure if this is the correct terminology) background workers.

My question is, whenever the backgroundworker is invoked, the program creates another notifyicon in the taskbar. And this keeps on happening whenever the worker is invoked. Initially, when I hover over the icons, they seem to have the sameproperties as intended and "hold fort", however, after sometime (possibly 20 seconds or more), if I hover over them,they disappear.

Has anyone come accross this and / or how can I stop this behaviour?
0
Comment
Question by:nepaluz
  • 12
  • 7
19 Comments
 
LVL 17

Author Comment

by:nepaluz
ID: 34131167
I should add that I am looking for a solution to STOP my program spawning these other notifyicons.
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 34131243
That isn't "normal" behavior.  What do your BackgroundWorkers do?  Show us any code that is accessing the NotifyIcons please...surely you must be making them appear somehow.  =\
0
 
LVL 17

Author Comment

by:nepaluz
ID: 34131263
Strange as it may seem, there is NO code at all that fires the notifyicon. I have added it through the designer, and apart from handling its click event, no other code accesses / fires the notifyicon (so far!). I intend to implement a balloon tip in the future, however, as it stands, not yet.

The code for handling the clickevent is:


Private Sub NotifyIcon1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NotifyIcon1.Click

    Me.Show()

End Sub

Open in new window

0
 
LVL 17

Author Comment

by:nepaluz
ID: 34131274
see image example
iconspawn.gif
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 34131292
Are you sure these icons are not from previous instances that didn't shut down properly?

So when you first run the app, there is only one icon?  ...and you are getting more icons while the app is still running?

Are you creating other instances of the main form via code?
0
 
LVL 17

Author Comment

by:nepaluz
ID: 34131343
1. I am sure that the icons are NOT from previous instances.
2. Before I run the app, there are not icons. I can literally see the icons being "born" when the backgroundworker is fired.
3. There are NO instances of the form being created via code.

I have to say that the backgroundworker does update the form via the progress changed where it MAY change a few images on the main form (but NEVER addresses the notifyicon).
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 34131356
Ok...we've eliminated the obvious culprits then.

Nothing left to do but examine your code.  Can we see a what happens in your ProgressChanged() event?

Are you doing any manual invoking directly from the background threads?
0
 
LVL 17

Author Comment

by:nepaluz
ID: 34131392
Here is a typical one. I actually have around 3 other BGWs, but essentially they update the main form in the same vein.

Private Sub CheckWorker_ProgressChanged(ByVal sender As Object, ByVal e As System.ComponentModel.ProgressChangedEventArgs) Handles CheckWorker.ProgressChanged

    Dim xState As CheckIfNationwide.CheckNWState = DirectCast(e.UserState, CheckIfNationwide.CheckNWState)

    Select Case xState.iResult

        Case "OK"

           For x = 0 To Me.DataGridView1.RowCount - 1

                If Me.DataGridView1.Item(1, x).Value = xState.aResult(0).ToString.Split("\").Last Then

                    Dim iCell = DirectCast(Me.DataGridView1.Item(0, x), DataGridViewImageCell)

                    iCell.Value = My.Resources.NOFXConverter16

                    Me.DataGridView1.Item(3, x).Value = "Updating. Please wait ..."

                End If

                Next

        Case "ER"

            For x = 0 To Me.DataGridView1.RowCount - 1

                If Me.DataGridView1.Item(1, x).Value = xState.aResult(0).ToString.Split("\").Last Then

                    Dim iCell = DirectCast(Me.DataGridView1.Item(0, x), DataGridViewImageCell)

                    iCell.Value = My.Resources.NOFXConverter16X

                    Me.DataGridView1.Item(3, x).Value = "Not a Natiowide file."

                End If

            Next

        End Select



    End Sub

Open in new window

0
 
LVL 17

Author Comment

by:nepaluz
ID: 34131460
To add to that, I do have one instance (in one of the BGWs) where I call (invoke??) another class.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 34131478
Nothing throws up red flags in my mind there...

What are you manually invoking?

What is the startup object for your application?
0
 
LVL 17

Author Comment

by:nepaluz
ID: 34131519
The class I invoke / call from the BGW writes a file to disk. Basically, thats all it does. I do pass to it, though, a list of string which I initialize from within the class with the "embeded" BGW (if that makes any sense). Apart from that, I can not see anything else.
0
 
LVL 17

Author Comment

by:nepaluz
ID: 34131527
I lie, its a list of objects which includes strings and a datatable, all initialized from within the class with the "embeded" BGW.
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 34131534
Like you, I still can't see where the root of the problem lies.

What is the startup object for the app?  I assume it's a form?  Is it the same form that has the BackgroundWorkers?

Really trying to get the big picture for the flow of your app.
0
 
LVL 17

Author Comment

by:nepaluz
ID: 34131546
Yep, its a windows form and I have added all the BGWs through the designer.
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 34131639
Can you post all the code?

...or zip it up and change the extension to .txt so you can upload it here.
0
 
LVL 17

Author Comment

by:nepaluz
ID: 34131668
Hmm! not sure I want to post the entire project here.
0
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 34131680
Completely understand.  Without more detail I don't think we're going to be able to spot the source of the problem.

You could try building a new project from scratch and start adding the features in one at a time in an attempt to narrow down what is causing the symptom.
0
 
LVL 17

Assisted Solution

by:nepaluz
nepaluz earned 0 total points
ID: 34131722
I'll try and replicate the problem in a smaller app that I can post here.
0
 
LVL 17

Author Closing Comment

by:nepaluz
ID: 34399207
I haveresolved this issue, butcan not trackback wherewe were. I am also un-able to post a replication of the problem, thus the partial acceptance.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Copy Data from one datatable to another datatable. 8 55
GridDataView 6 44
Merging PDFs with VB.NET 10 31
Open a word document 23 0
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now