![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Am I missing something in regards to the structure of the text file or perhaps how it is added? |
#3
| |||
| |||
|
|
Am I missing something in regards to the structure of the text file or perhaps how it is added? I assume you're using Visual Studio (?). If so then are you aware that it already has a built-in mechanism to handle strings for you (with relatively little work on your part)? |
#4
| |||
| |||
|
|
Hey Larry, As I mentioned in the original post, I am using the stings available under "Resources". What I am asking for is a way to segregate these strings into intelligent collections probably via separate files. That said, how can I load and use separate resource files into the list of resources? How can I use code similar to that below: Dim rm As ResourceManager Dim Message as StringBuilder rm = New ResourceManager("StringTable", Me.GetType().Assembly) Message = New StringBuilder() Message.Append(rm.GetString("String1")) Message.Append(rm.GetString("String2")) MessageBox.Show(Message.ToString()) |
#5
| |||
| |||
|
|
Hey Larry, As I mentioned in the original post, I am using the stings available under "Resources". What I am asking for is a way to segregate these strings into intelligent collections probably via separate files. That said, how can I load and use separate resource files into the list of resources? How can I use code similar to that below: Dim rm As ResourceManager Dim Message as StringBuilder rm = New ResourceManager("StringTable", Me.GetType().Assembly) Message = New StringBuilder() Message.Append(rm.GetString("String1")) Message.Append(rm.GetString("String2")) MessageBox.Show(Message.ToString()) What I was alluding to is that you don't need to do this (or rather you're probably making your life more difficult). First, ".resx" files for forms are handled automatically by VS (referring to all strings that appear on your forms for instance). If you're not aware of the details please let me know (it seems that way). For other resources like error messages and so forth, go to Solution Explorer and right-click your project's node. Select "Properties" from the context menu and click "Resources" on the left-hand side. A table now appears where you can enter all (non-form) resources which are usually strings (you may have to click on the notice in the middle of the window first if there is one - it will be present if it's the first time doing this). VS then creates a wrapper class called "Resources" where you can now access any single resource (string or whatever) via the YourProjectNamespace>.Properties.Resources.<Resour ceName> static property (a "using <YourProjectNamespace>.Properties" statement is required in each source file of course). For instance, if you add "MyString=Whatever" to the table and your project's namespace is "YourProjectNamespace", you can do this: using YourProjectNamespace.Properties; // ... string MyString = Resources.MyString; You can access all resources this way, not just strings. |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |