Hi Everybody,
I am developed an application software in that i want to use notification Icon. But it seems to doesn't work for me. can anybody help me?

Here is my code

private void button29_Click(object sender, EventArgs e)
        {
            notifyIcon1.Visible = true;
            notifyIcon1.ShowBalloonTip(2000, "Hello", "Hi", ToolTipIcon.Info);
           
        }

it will not display any notification....

Thanks in advance

Dani AI

Generated

As pointed out, the missing tray icon is the usual cause — once an Icon is present the balloon will appear, as confirmed. A few additional, less obvious gotchas can still stop a notification from showing or make it disappear immediately.

Common checks to run before assuming a platform bug:

  • make sure the NotifyIcon instance is alive and its Visible property is true when you call the notification API; if the app exits or the component is disposed right after the call the balloon will not stay visible.
  • allow a short delay after making the icon visible before triggering a balloon; the shell sometimes needs time to add the icon to the tray.
  • keep a message loop running (WinForms apps do this automatically). If you run from a console app or a short-lived process, use an ApplicationContext or keep the process alive while the balloon is shown.
  • avoid disposing the Icon or NotifyIcon object until after the balloon has finished; disposing too early cancels the balloon.
  • remember that modern Windows may override the requested timeout or route balloons to Action Center; behavior is controlled by the OS and user settings.

A minimal pattern to show a balloon from a non-UI entry point is to host the tray icon in an ApplicationContext, set an icon (SystemIcons.Application can be used to avoid external files), then call ShowBalloonTip after a brief timer so the shell registers the icon.

If the goal is richer or persistent notifications on newer Windows releases, consider using the native Toast Notification APIs instead of the legacy balloon approach.

Recommended Answers

All 2 Replies

Hello,

You forgot to assign an icon. This code works for a Win-Form-Application:

private void Form1_Click(object sender, EventArgs e)
        {
            notifyIcon1.Icon = new System.Drawing.Icon(@"c:\temp\Administrator.ico");

            notifyIcon1.BalloonTipText = "Hello";
            notifyIcon1.BalloonTipTitle = "Message";
            notifyIcon1.BalloonTipIcon = ToolTipIcon.Warning;
            notifyIcon1.Visible = true;
            notifyIcon1.ShowBalloonTip(10000);
        }

hi C#Jaap
Thanks for reply its Working

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.