I added a resource file into my project, to store the caption of buttons and
labels..
How do I make use of this resource file to dynamically assign to the buttons
and labels ?
Jul 5 '06
11 1982
Alan,
There might be as many resources as you want with one application. the
resources can be stored in on the disk as resx files, embeded in the an
assembly, in satellite assembly, etc. I addtion any files that you want can
be added as a embedded resource to your assembly.
The resource file the windows forms form or user control uses to store
localized proeprty values is hidden by default. In order to see it click on
the "Show All Files" button from the solution explorer toolbar. Then you can
see [+] sign next to the form or user control node on the tree. Expand the
node and you'll see the resx file.
In order to read resource at runtime you can use the ResourceManager class
or alternatively you can use Assembly.GetMan ifestResourceSt ream method.
My suggestion is to turn on the localization on some test form and look at
the InitializeCompo nent method the code that VS generates.
--
HTH
Stoitcho Goutsev (100)
"Alan T" <al************ *@yahoo.com.auw rote in message
news:eN******** ******@TK2MSFTN GP05.phx.gbl...
How do I read the resource file of a Windows Form? Is that with
extension.resx ?
"Stoitcho Goutsev (100)" <10*@100.comwro te in message
news:eI******** ********@TK2MSF TNGP05.phx.gbl. ..
>Yes, this is the place for that and as I said for WinForms it works atomatically when localization is turned on. VS will save to resource and generate a code for reading the values from there for any property attributed with LocalizableAttr ibute.
-- HTH Stoitcho Goutsev (100)
"Alan T" <al************ *@yahoo.com.auw rote in message news:uZ******* *******@TK2MSFT NGP04.phx.gbl.. .
>>Hi,
In addition, is there really a way, I mean using the resource file to configure the display caption of labels, buttons or treeview nodes text, listview column text. Is resource file's purpose for that ?
"Alan T" <al************ *@yahoo.com.auw rote in message news:uS****** ********@TK2MSF TNGP04.phx.gbl. .. So I think I should use the 'Application'.
"Stoitcho Goutsev (100)" <10*@100.comwro te in message news:u7***** *********@TK2MS FTNGP03.phx.gbl ... Alan, All settings in the application scope apply for all users. The settings in the user scope are per user, thus the proeprty values can be different depending on who runs the applciation. > > -- Stoitcho Goutsev (100) > "Alan T" <al************ *@yahoo.com.auw rote in message news:OG**** **********@TK2M SFTNGP04.phx.gb l... >Hi, >> >Is what I did is correct ? >> >Right click the project >Add New Item >Choose 'Settings File' >Define the entries in the file >> >Then - >"In the designer select a control and then from the property window >expand the "Applicatio n Settings" node, which is the first on the >top. You >can choose any control property form the PropertyBinding collcection >and you >can also choose whether the property should go in the user or global >" >> >What will be the differences between 'user' and 'application' ? >> >> >"Stoitch o Goutsev (100)" <10*@100.comwro te in message >news:ur*** *************@T K2MSFTNGP04.phx .gbl... >>Alan, >>> >>The easiest would be to turn on the localization for the form. Just >>set the form's Localizable property to *true*. Once you do this all >>the form and form's controls properties such as Text, Size, >>Locatio n, etc will go to a resource file and the designer will >>generat e the code to load them from there. If you want to use your >>own resource file I'm afraid you need to read the values and set the >>control s by yourself. >>> >>Anoithe r solution would be to use the application settings for >>storing the values. In the designer select a control and then from >>the property window expand the "Applicatio n Settings" node, which is >>the first on the top. You can choose any control property form the >>PropertyB inding collcection and you can also choose whether the >>propert y should go in the user or global , >> >> >>(applicat ion) settings. >>> >>> >>-- >>HTH >>Stoitch o Goutsev (100) >>> >>> >>"Alan T" <al************ *@yahoo.com.auw rote in message >>news:%2** **************@ TK2MSFTNGP05.ph x.gbl... >>>It is a Windows application. >>>What I want is to dynamically store the string to the form's label >>>and buttons'caption . >>>> >>>This is useful if we want to internationaliz e the application with >>>other language. >>>> >>>"Stoitch o Goutsev (100)" <10*@100.comwro te in message >>>news:O9* *************@T K2MSFTNGP05.phx .gbl... >>>>Alan, >>>>> >>>>What type of application is it - win or web? >>>>> >>>>> >>>>-- >>>>Stoitch o Goutsev (100) >>>>> >>>>"Alan T" <al************ *@yahoo.com.auw rote in message >>>>news:u7 **************@ TK2MSFTNGP03.ph x.gbl... >>>>>>I added a resource file into my project, to store the caption of >>>>>>butto ns and labels.. >>>>>How do I make use of this resource file to dynamically assign to >>>>>the buttons and labels ? >>>>>> >>>>> >>>>> >>>> >>>> >>> >>> >> >> > >
Back to the settings file:
What will be the effect between using the "user" and "applicatio n" scope?
eg.
I define that as "user" scope and my user runs my application.
"Stoitcho Goutsev (100)" <10*@100.comwro te in message
news:Oa******** ******@TK2MSFTN GP05.phx.gbl...
Alan,
There might be as many resources as you want with one application. the
resources can be stored in on the disk as resx files, embeded in the an
assembly, in satellite assembly, etc. I addtion any files that you want
can be added as a embedded resource to your assembly.
The resource file the windows forms form or user control uses to store
localized proeprty values is hidden by default. In order to see it click
on the "Show All Files" button from the solution explorer toolbar. Then
you can see [+] sign next to the form or user control node on the tree.
Expand the node and you'll see the resx file.
In order to read resource at runtime you can use the ResourceManager class
or alternatively you can use Assembly.GetMan ifestResourceSt ream method.
My suggestion is to turn on the localization on some test form and look at
the InitializeCompo nent method the code that VS generates.
--
HTH
Stoitcho Goutsev (100)
"Alan T" <al************ *@yahoo.com.auw rote in message
news:eN******** ******@TK2MSFTN GP05.phx.gbl...
>How do I read the resource file of a Windows Form? Is that with extension.re sx ?
"Stoitcho Goutsev (100)" <10*@100.comwro te in message news:eI******* *********@TK2MS FTNGP05.phx.gbl ...
>>Yes, this is the place for that and as I said for WinForms it works atomaticall y when localization is turned on. VS will save to resource and generate a code for reading the values from there for any property attributed with LocalizableAttr ibute.
-- HTH Stoitcho Goutsev (100)
"Alan T" <al************ *@yahoo.com.auw rote in message news:uZ****** ********@TK2MSF TNGP04.phx.gbl. .. Hi,
In addition, is there really a way, I mean using the resource file to configure the display caption of labels, buttons or treeview nodes text, listview column text. Is resource file's purpose for that ?
"Alan T" <al************ *@yahoo.com.auw rote in message news:uS***** *********@TK2MS FTNGP04.phx.gbl ... So I think I should use the 'Application'. > "Stoitcho Goutsev (100)" <10*@100.comwro te in message news:u7**** **********@TK2M SFTNGP03.phx.gb l... >Alan, >All settings in the application scope apply for all users. The >settings in the user scope are per user, thus the proeprty values can >be different depending on who runs the applciation. >> >> >-- >Stoitcho Goutsev (100) >> >"Alan T" <al************ *@yahoo.com.auw rote in message >news:OG*** ***********@TK2 MSFTNGP04.phx.g bl... >>Hi, >>> >>Is what I did is correct ? >>> >>Right click the project >>Add New Item >>Choose 'Settings File' >>Define the entries in the file >>> >>Then - >>"In the designer select a control and then from the property window >>expand the "Applicatio n Settings" node, which is the first on the >>top. You >>can choose any control property form the PropertyBinding collcection >>and you >>can also choose whether the property should go in the user or global >>" >>> >>What will be the differences between 'user' and 'application' ? >>> >>> >>"Stoitc ho Goutsev (100)" <10*@100.comwro te in message >>news:ur** **************@ TK2MSFTNGP04.ph x.gbl... >>>Alan, >>>> >>>The easiest would be to turn on the localization for the form. Just >>>set the form's Localizable property to *true*. Once you do this all >>>the form and form's controls properties such as Text, Size, >>>Location , etc will go to a resource file and the designer will >>>genera te the code to load them from there. If you want to use your >>>own resource file I'm afraid you need to read the values and set >>>the controls by yourself. >>>> >>>Anoith er solution would be to use the application settings for >>>storin g the values. In the designer select a control and then from >>>the property window expand the "Applicatio n Settings" node, which >>>is the first on the top. You can choose any control property form >>>the PropertyBinding collcection and you can also choose whether the >>>proper ty should go in the user or global , >>> >>> >>>(applica tion) settings. >>>> >>>> >>>-- >>>HTH >>>Stoitc ho Goutsev (100) >>>> >>>> >>>"Alan T" <al************ *@yahoo.com.auw rote in message >>>news:%2* *************** @TK2MSFTNGP05.p hx.gbl... >>>>It is a Windows application. >>>>What I want is to dynamically store the string to the form's label >>>>and buttons'caption . >>>>> >>>>This is useful if we want to internationaliz e the application with >>>>other language. >>>>> >>>>"Stoitc ho Goutsev (100)" <10*@100.comwro te in message >>>>news:O9 **************@ TK2MSFTNGP05.ph x.gbl... >>>>>Alan , >>>>>> >>>>>What type of application is it - win or web? >>>>>> >>>>>> >>>>>-- >>>>>Stoitc ho Goutsev (100) >>>>>> >>>>>"Ala n T" <al************ *@yahoo.com.auw rote in message >>>>>news:u 7************** @TK2MSFTNGP03.p hx.gbl... >>>>>>>I added a resource file into my project, to store the caption of >>>>>>>butt ons and labels.. >>>>>>How do I make use of this resource file to dynamically assign to >>>>>>the buttons and labels ? >>>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>> >>>> >>> >>> >> >> > > This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mark H. |
last post by:
I just converted a solution from VC++ .net 2002 to
VC++ .net 2003. Help IDs are associated with most
controls on the dialogs in the solution's projects.
Whenever I go to Resource View and expand the tree for
a .rc file that contains dialogs, a dialog displays asking
me if I want to check out Resource.hm. If I click Cancel
in the check out dialog, the dialog displays again. This
continues one time for each dialog in the project. Then...
|
by: J.Marsch |
last post by:
Hello all:
I am trying to build a resource dll that will house icons, and I'm afraid
that I'm not having much luck reading it. Can you lend hand (or just point
me to a good primer).
Here's what I've done so far: (VS.NET 2003/C#)
1. Created an empty project for the resource dll. Output type is class
library.
|
by: Bonj |
last post by:
when creating a resource-only dll, the only way I can get it to compile and
work correctly, is to make it a non-resource-only dll.
surely this can't be the way...?
basically, there is a load of resources, in a dll. The DLL is a managed
class library, but it has got an unmanaged function that accesses the
resources. FindResource only works on the HMODULE that is gained by casting
the HINSTANCE passed to DllMain into an HMODULE (I think...
|
by: Turbot |
last post by:
Hello, After much searching, I have finally determined how to add gif
files into a resource and then get them out again in VB.NET. I have
created a resx file and have inserted a bunch of GIF files using a
resource editor that I got from CodeProject. I am then using the
following code to apply one of the graphics to an Image object:
Dim objRM As New
System.Resources.ResourceManager("TutorPro.resHighlights",
Me.GetType.Assembly)...
|
by: Dom |
last post by:
I get an InvalidOperationException with the message "The resource class for
this page was not found. Please check if the resource file exists and try
again." when I change the resource file of a user control.
If I recompile the exception is no longer thrown, however this is also an
issue on the production site (where we want to change resource files without
having to deploy a new build). The only ways around this issue I have
discovered...
| |
by: Larry Gillstrom |
last post by:
Hi
Our company is trying to migrate all of our products developed in msvc 6 to
msvc 2005. Everything was going smoothly until we discovered that msvc 2005
will not save any changes we make in our resource (rc) files. And if we do
make a change in the resource file, msvc 2005 crashes on exit.
I noticed someone else reported this bug a few weeks ago, does anyone know
if there is a decent workaround for this?
|
by: vecozo |
last post by:
Centralized resource files
Hi,
We are considering to migrate our custom asp.net localization procedure, to
one that stored .Text properties of controls in a SQL database, towards the
usage of standard resources (hence .resx files). Plain Resx files do not seem
to be a very scalable solution: We have dozens of servers and we do not want
to access all servers to deploy files in case of minor changes in the
personalized text. So we need...
|
by: John Dunn |
last post by:
Since currently we aren't allowed to have compiled XAML files embedded in C++
apps I'm using Markup::XamlReader::Load to dynamically load XAML files. This
works perfectly fine with external files but I'd like to be able to load a file
specified in a .resx resource.
I've added my .xaml file to the .resx and can load it in using
ResourceManager::GetObject(). The object returned is a System::Array^ which
contains System::Byte objects. The...
|
by: CodeLeon |
last post by:
Hi, All. I am creating a setup program. The way it works is that the
user creates their setup info, my program generates the C# code for a
setup executable, embeds the xml file containing the info for the
setup, and compiles the whole thing into one EXE. How do i embed
resources, and access them, into that assembly?
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |