Share via

WinForms Form icon changes to EXE icon when positioned beside taskbar overflow (Windows 11)

test code 21 Reputation points
2026-02-27T07:23:30.9133333+00:00

In a VB.NET WinForms application (.NET Framework 4.0) running on Windows 11, a specific icon switching behavior occurs when the taskbar becomes crowded.

Here is my code snippet:

Public Class Form1
   Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
   Try
    Me.Icon = New Icon("C:\Users\User1\source\repos\ForumSampleIcon\ForumSampleIcon\bin\Debug\Icons\resumelist.ico")
   Catch ex As Exception
    MsgBox(ex.Message)
   End Try
  End Sub
 End Class

I am using Me.Icon inside my form's load event to set my application icon which appears in the taskbar.

I notice the behavior when my application icon is positioned next to the "three dots": the displayed taskbar icon switches from the specific Form icon to the executable (.exe) icon. Once the number of taskbar icons is reduced and the overflow tray disappears, the icon automatically reverts to the original Form icon.

Reproduction steps**:**

  1. Create a Winforms application where the form icon is set in Form load event using Me.Icon as shown in the above code:
  2. In taskbar settings, change the "taskbar alignment" to Left and change "Combine taskbar buttons and hide labels" to Never
  3. Open many applications until the Windows 11 taskbar overflows
  4. Launch the WinForms application

Actual result**:**

If my application is moved inside the overflow area then the form icon remains visible. But if my application gets positioned next to overflow area i.e near three dots then the application icon gets changed to exe icon.

Expected result:
If my application icon gets positioned next to the overflow area (i.e. near to three dots) in the taskbar, then the application icon is expected to remain the same (i.e the form icon)

What I already checked:
I have tried using combination of setting Me.Icon & using SendMessage to set the icon inside Form's OnActivated event, toggling DPIAwareness to true/false and changing the icon to MS File Explorer (to verify if issue is with my icon's format) in the following order:

|Form OnActivated event |DPI Awareness|MS File Explorer Icon|Result| | -------- | -------- | -------- | -------- | |Using Me.icon to set icon|False|No|Form icon is displayed in taskbar but it changes to exe icon when it is near three dots (...) during overflow.| |Using Me.icon to set icon|False|Yes|Form icon is displayed in taskbar but it changes to exe icon when it is near three dots (...) during overflow.| |Using Me.icon to set icon|True|No|Form icon is displayed in taskbar but it changes to exe icon when it is near three dots (...) during overflow.| |Using SendMessage to set icon|False|Yes|Form icon is displayed in taskbar but it changes to exe icon when it is near three dots (...) during overflow.| |Using SendMessage to set icon|True|No|Form icon is displayed in taskbar but it changes to exe icon when it is near three dots (...) during overflow.|***Question:
***I would like to understand whether this is expected Windows behavior or related to WinForms icon handling.

***Screenshot:
***FormIconissue

Developer technologies | Visual Basic for Applications

1 answer

Sort by: Most helpful
  1. Varsha Dundigalla(INFOSYS LIMITED) 4,785 Reputation points Microsoft External Staff
    2026-02-27T09:42:29.1433333+00:00

    Thank you for reaching out.

    This behavior is not caused by WinForms code or by using Me.Icon. What you are seeing is due to how Windows 11 handles taskbar icons when the taskbar overflows.

    In a WinForms application, there are two different icons involved:

    • The form icon, which you set using Form.Icon or Me.Icon
    • The application (EXE) icon, which is embedded into the executable using Visual Studio project settings

    When the taskbar has enough space, Windows usually shows the form icon. However, when the taskbar becomes crowded and the overflow appears, Windows may rearrange taskbar buttons and internally fall back to using the application (EXE) icon instead. This decision is made by the Windows shell and happens dynamically, without restarting the application or changing any code.

    This is why the icon:

    • Changes only when the app is positioned near the overflow button
    • Automatically returns to the form icon when the overflow disappears
    • Cannot be forced or overridden using WinForms APIs or SendMessage

    Because taskbar overflow behavior is controlled by Windows and not documented in detail, there is no supported way to guarantee that the runtime form icon will always be used in every taskbar layout. The recommended and supported approach is to make sure the application icon (EXE icon) is set correctly, so that even if Windows falls back to it, the icon remains consistent.

    You can set the application icon using the standard Visual Studio project settings as described here: https://learn.microsoft.com/en-us/visualstudio/ide/how-to-specify-an-application-icon-visual-basic-csharp

    Please let us know if you require any further assistance, we’re happy to help. If you found this information useful, kindly mark this as "Accept Answer". So that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.

    1 person found this answer helpful.

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.