Click here to Skip to main content
15,900,907 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi, I try to show up a notification when an if statement is true, but it doesn't show up
also I checked the win 11 notification is something was on, but all things is off.
In case I can only create a custom one.

S.O = Win 11
Version of Visual Studio = 2022

What I have tried:

If n <= 3 AndAlso n >= 1 Then
NotifyIcon1.ShowBalloonTip(3000, "test", n & " is in the range", ToolTipIcon.None)
  End If
Updated 20-Jan-22 10:55am
Luc Pattyn 19-Jan-22 23:11pm    
Sorry to ask, but do you have something like notifyIcon1.Visible = true; anywhere?
MXwell8 19-Jan-22 23:14pm    
yea I was thinking also on that, I added it on form load but doesn't appear.
Luc Pattyn 19-Jan-22 23:27pm    
So you do see the notifyIcon (and your title isn't accurate)?

I've never used ShowBalloonTip, I use Text property to get a simple tooltip.
MXwell8 19-Jan-22 23:34pm    
no the notification doesn't show. Oh, your right I read it now I'll fix it.
Also thanks for the tip.
Luc Pattyn 19-Jan-22 23:43pm    
Please make sure the creation and all operations on the notifyIcon occur from the GUI thread; if not, the strangest things can happen (or the most normal things might not).

1 solution

I tested this C# code snippet on Win 10:
NotifyIcon ni = new NotifyIcon();
ni.Icon = SystemIcons.Exclamation;
ni.Visible = true;
ni.ShowBalloonTip(1000, "title", "text", ToolTipIcon.Error);

It shows a permanent notifyicon in the taskbar and a temporary balloontip in the notifications area.
Without setting visibility nothing shows. Without setting icon nothing shows.

Translation to VB.NET should be straightforward. I did not test on Win 11.

Share this answer
thatraja 20-Jan-22 21:41pm    
Richard Deeming 21-Jan-22 3:47am    
I've just tested it in Windows 11, and as expected, the behaviour is the same as you describe in Windows 10. :)
Luc Pattyn 21-Jan-22 10:24am    
Thanks Richard.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900