Search code examples
c#winforms

setting Form.Text in WinForms Form does not update the title


I have this piece of code in my routine but it doesnt seem to work:

public MainForm()
{
  InitializeComponent();
  this.Text = "Elvis " + AssemblyVersion;
}

In my designer I had set the form title to "Elvis". I see that the AssemblyVersion info gets added to the text properly but the title doesnt get updated at all. I've tried refresh, invalidate etc, but nothing works. Any idea how I can update the title at runtime?

I am using .NET 3.5 and VS 2008.

thanks


Solution

  • This generally works just fine. Setting the Text property of a Form will change the title of the window. So can you post more code? It's possible your Text property is later getting overwritten without you realizing it.