SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

Using resources to set the window title bar text

Last post 04-30-2007 2:21 PM by zippy1981. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 04-02-2007 7:58 PM

    Using resources to set the window title bar text

    How do I set the Form banner text (Form.Text) to the value of a resource string?
  • 04-03-2007 5:13 AM In reply to

    Re: Using resources to set the window title bar text

    Try this - the ResourceToolkit addin is very nice :-)

    Add a resource file to your project, and put a string in it. Then add this code: 

    Dim ResMgr As New System.Resources.ResourceManager("MyProgram.ResourceFileName", My.Application.GetType().Assembly)

    Form.Text = ResMgr.GetString("TitleBarText")

  • 04-04-2007 11:42 AM In reply to

    • VITRIOL
    • Top 100 Contributor
    • Joined on 08-22-2005
    • Italy
    • Posts 21

    Re: Using resources to set the window title bar text

    Blue Ninja:

    Try this - the ResourceToolkit addin is very nice :-)

    Add a resource file to your project, and put a string in it. Then add this code: 

    Dim ResMgr As New System.Resources.ResourceManager("MyProgram.ResourceFileName", My.Application.GetType().Assembly)

    Form.Text = ResMgr.GetString("TitleBarText")

     

    Interesting. How can I do in C#, without My object?

     

    Thanks
     

  • 04-04-2007 12:44 PM In reply to

    Re: Using resources to set the window title bar text

    To get the current assembly, you can use any type that is in the assembly. E.g. typeof(CurrentClassName).Assembly
     

    Daniel Grunwald
  • 04-04-2007 1:39 PM In reply to

    • VITRIOL
    • Top 100 Contributor
    • Joined on 08-22-2005
    • Italy
    • Posts 21

    Re: Using resources to set the window title bar text

    DanielGrunwald:

    To get the current assembly, you can use any type that is in the assembly. E.g. typeof(CurrentClassName).Assembly
     

     

    Thank you Daniel. It works fine.

  • 04-30-2007 10:28 AM In reply to

    Re: Using resources to set the window title bar text

    Hi! Would be interested to use the Resource string to set the Form Title (Form.Text) at Design Time. Is there any WinForms resource-binding expressions available like in ASP.NET 2.0? Thank you!
  • 04-30-2007 10:57 AM In reply to

    Re: Using resources to set the window title bar text

    The title of the form (the bar that you can move around) can be changed with this text in C#...

    this.text = " Yippe! ";

    I show how to do that in another link here...

    http://community.sharpdevelop.net/forums/thread/16621.aspx

    As far as the Resource file, you should still be able to use the code that is shown you in above messeges.

    Hope this helps,

    JW.

  • 04-30-2007 2:21 PM In reply to

    Re: Using resources to set the window title bar text

    VITRIOL:

    Interesting. How can I do in C#, without My object?

     

    Thanks
     

    ResourceManager ResMgr;
                ResMgr = new ResourceManager("Temp.Temp", this.GetType().Assembly);
                this.Text = ResMgr.GetString("TitleBar");

     

    BTW, Blue Ninja forgets to mentions that the first parameter to the ResourceManager constructor is "Assembly.ResourcefileWithourExtension". Luckily this one is very easy to figure out by the exception thrown. 

Page 1 of 1 (8 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.