Windows Form Caption and Task Bar Text

BigKev
StarLounger
Posts: 78
Joined: 10 Feb 2010, 12:54
Location: Jeddah, Saudi Arabia

Windows Form Caption and Task Bar Text

Post by BigKev »

Does anybody know if it is possible to have the Task Bar Text for a Window/Form different to the Window/Form Caption Text and if so can it be done via code (VB .NET)?

I've Googled to no avail.

Cheers,
Kevin

User avatar
HansV
Administrator
Posts: 78463
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Windows Form Caption and Task Bar Text

Post by HansV »

The form caption and taskbar caption are inextricably connected. As far as I know, you need to use a rather dirty trick:

Set your form's ShowInTaskbar property to False.

Open another form with ShowInTaskbar set to True; this one has the caption you want to show in the taskbar.
Position this form off the screen and minimize it, and make clicking on the taskbar activate the other form:

Code: Select all

Private Sub Form_Activate()
  Me.WindowState = vbMinimized
  Form1.Show
End Sub
where Form1 is the name of the visible form.
Best wishes,
Hans

BigKev
StarLounger
Posts: 78
Joined: 10 Feb 2010, 12:54
Location: Jeddah, Saudi Arabia

Re: Windows Form Caption and Task Bar Text

Post by BigKev »

HansV wrote:The form caption and taskbar caption are inextricably connected. As far as I know, you need to use a rather dirty trick:

Set your form's ShowInTaskbar property to False.

Open another form with ShowInTaskbar set to True; this one has the caption you want to show in the taskbar.
Position this form off the screen and minimize it, and make clicking on the taskbar activate the other form:

Code: Select all

Private Sub Form_Activate()
  Me.WindowState = vbMinimized
  Form1.Show
End Sub
where Form1 is the name of the visible form.
Sneaky. I like it. I will give it a try.

Thanks and regards,
Kevin